Telerik DevRel
Developer Relations team @ Telerik!
Jen Looper
Senior Developer Advocate, Progress
•Multiple codebases
•Fragmented platforms
•Multiple language choices and IDEs
•Keeping features in sync
You need...a seed!
https://github.com/TeamMaestro/angular-native-seed
*Sean Perkins, Developer Expert
web app
mobile app
A framework for building native cross-platform mobile apps...
No-compromise, smoothly-animating native mobile apps for iOS and Android
Just JavaScript!
You know JavaScript? You know NativeScript!
Use JavaScript, CSS, XML to construct the app
work in /src
page folders
web = .html
mobile = .tns.html
Events only exists on mobile: needs separate .tns modules and routing modules (web build disregards)
Lightshow only exists on web: mobile app needs empty .tns files to webpack properly
Idea: share what code you can on the component level, and create separate .tns files for mobile when needed.
symlinks copy code into /nativescript folder
add mobile assets to App_Resources
builds occur here
Routing module, split
// angular
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
// app
import { EventsRoutes } from './events.routes';
@NgModule({
imports: [
RouterModule.forChild(EventsRoutes)
],
exports: [RouterModule]
})
export class EventsRoutingModule { }
// angular
import { NgModule } from '@angular/core';
import { NativeScriptRouterModule } from 'nativescript-angular';
// app
import { EventsRoutes } from './events.routes';
@NgModule({
imports: [
NativeScriptRouterModule.forChild(<any>EventsRoutes),
],
exports: [NativeScriptRouterModule]
})
export class EventsRoutingModule { }
web
mobile
presentation tier
<div class="content">
<ul class="actions">
<li (click)="startLightShow('rainbow')"><a class="button special rainbow">Start a Rainbow light show!</a></li>
<li (click)="startLightShow('red')"><a class="button special red">Start a Red light show!</a></li>
<li (click)="startLightShow('blue')"><a class="button special blue">Start a Blue light show!</a></li>
<li (click)="startLightShow('green')"><a class="button special green">Start a Green light show!</a></li>
<li (click)="startLightShow('clear')"><a class="button special black ">End light show</a></li>
</ul>
</div>
<ActionBar title="Events"></ActionBar>
<ScrollView>
<StackLayout>
<StackLayout *ngFor="let event of (events$ | async)">
<Button class="blue" [text]="event.name" (tap)="chooseEvent(event.id)"></Button>
</StackLayout>
</StackLayout>
</ScrollView>
web
mobile
Integration with Angular CLI - stay tuned!
By Telerik DevRel
For Angular NYC - 20 minute preso