KEMBAR78
NativeScript and Angular | PPTX
NativeScript + Angular 2
Jen Looper
Developer Advocate
@jenlooper
What is NativeScript?
• Open source framework
• Create native mobile apps for iOS, Android
(and eventually Windows Universal)
• Use JavaScript (“web skills”)
• Write once, run everywhere
• Share 100% code between iOS/Android
• Share 80% code with web
• Reuse popular plugins from
NodeJS/iOS/Android
• Integrates deeply with Angular and
TypeScript
+
Xamarin
(owned by
Microsoft)
Fuse Tools
React Native
(owned by
Facebook)
Ionic
(+ PhoneGap)
“Native Hybrid”
“Cross-compile” “Web Hybrid”
Rich, animated,
“no compromise”
native UI
Cross platform)
Two ways to write NativeScript
1)
2)
Standard JS + CSS + XML
Angular 2
Tobias
Bosch
Hristo
Deshev
ngConf
Fast facts:
● May 4th to 6th in Salt Lake City
● Largest Angular developer event in US
(~1300 developers)
Why NativeScript + Angular 2?
• Angular 1 = a technology that relies on browser tech to
manipulate the DOM.
• NativeScript has no DOM to manipulate
• Angular 2 decoupled the Angular framework from the
DOM
• The door is open to new mobile-friendly tech to
leverage this newly decoupled framework!!
A standard {N} app snippet
<!-- main.xml -->
<page>
<StackLayout>
<Button text= "Hello World" tap= "showAlert" />
</StackLayout>
</page>
/* main.js */
var dialogs = require("ui/dialogs");
exports.showAlert = function() {
dialogs.alert({ message: "NativeScript rocks!" });
};
Same functionality, {N} + ng2
// main.ts
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {Component, View} from "angular2/angular2";
import {dialogs} from "ui/dialogs";
@Component({})
@View({
directives: [],
template: `
<stack-layout>
<button
(tap)="showAlert()"
text="Hello World"></button>
</stack-layout>
`
})
class HelloPage {
showAlert() {
dialogs.alert({ message: "NativeScript rocks!" });
}
}
export function loaded() {
nativeScriptBootstrap(HelloPage, []);
}
The big picture
{N} Module
Native
iOS call
Native
Android call
iOS App Android App
The bigger picture ({N}+NG2)
HTTP
<Angular Component>
XMLHttpRequest
<NS Module>
Native
iOS call
Native
Android call
Ajax call
iOS App Android App Web App
XMLHttpRequest
<Browser>
Android iOS
Web
Adoption Goals (2016)
Goal for 2016: Grow NativeScript adoption by 15x
Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec
Aug Sept Oct Nov Dec
2x
2016
5x
3x
Google Angular2 event (“ngConf”);
NativeScript Angular2 push begins
Measured* active developers
(via NativeScript CLI)
• Active monthly CLI
users doubled
Aug to Dec ‘15
• Doubled again
Dec to Feb ’16
• Steady increase of
CLI use and new
users
Angular Roadmap
Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec
Microsoft
BUILD
ngConf
Angular 2 RC
{N} ng beta
Angular 2 (final)
{N} ng (final)
AngularConnect
(London)
We have an amazing community!
Join the growing
NativeScript
community on Slack
bit.ly/nativescript-slack
Modulus Sachse Construction Day Care This or That!
PocketSmith
NativeScript and Angular

NativeScript and Angular

  • 1.
    NativeScript + Angular2 Jen Looper Developer Advocate @jenlooper
  • 2.
    What is NativeScript? •Open source framework • Create native mobile apps for iOS, Android (and eventually Windows Universal) • Use JavaScript (“web skills”) • Write once, run everywhere • Share 100% code between iOS/Android • Share 80% code with web • Reuse popular plugins from NodeJS/iOS/Android • Integrates deeply with Angular and TypeScript
  • 3.
    + Xamarin (owned by Microsoft) Fuse Tools ReactNative (owned by Facebook) Ionic (+ PhoneGap) “Native Hybrid” “Cross-compile” “Web Hybrid”
  • 4.
  • 5.
    Two ways towrite NativeScript 1) 2) Standard JS + CSS + XML Angular 2
  • 9.
  • 10.
    ngConf Fast facts: ● May4th to 6th in Salt Lake City ● Largest Angular developer event in US (~1300 developers)
  • 11.
    Why NativeScript +Angular 2? • Angular 1 = a technology that relies on browser tech to manipulate the DOM. • NativeScript has no DOM to manipulate • Angular 2 decoupled the Angular framework from the DOM • The door is open to new mobile-friendly tech to leverage this newly decoupled framework!!
  • 12.
    A standard {N}app snippet <!-- main.xml --> <page> <StackLayout> <Button text= "Hello World" tap= "showAlert" /> </StackLayout> </page> /* main.js */ var dialogs = require("ui/dialogs"); exports.showAlert = function() { dialogs.alert({ message: "NativeScript rocks!" }); };
  • 13.
    Same functionality, {N}+ ng2 // main.ts import {nativeScriptBootstrap} from "nativescript-angular/application"; import {Component, View} from "angular2/angular2"; import {dialogs} from "ui/dialogs"; @Component({}) @View({ directives: [], template: ` <stack-layout> <button (tap)="showAlert()" text="Hello World"></button> </stack-layout> ` }) class HelloPage { showAlert() { dialogs.alert({ message: "NativeScript rocks!" }); } } export function loaded() { nativeScriptBootstrap(HelloPage, []); }
  • 14.
    The big picture {N}Module Native iOS call Native Android call iOS App Android App
  • 15.
    The bigger picture({N}+NG2) HTTP <Angular Component> XMLHttpRequest <NS Module> Native iOS call Native Android call Ajax call iOS App Android App Web App XMLHttpRequest <Browser>
  • 16.
  • 17.
    Adoption Goals (2016) Goalfor 2016: Grow NativeScript adoption by 15x Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec Aug Sept Oct Nov Dec 2x 2016 5x 3x Google Angular2 event (“ngConf”); NativeScript Angular2 push begins Measured* active developers (via NativeScript CLI)
  • 18.
    • Active monthlyCLI users doubled Aug to Dec ‘15 • Doubled again Dec to Feb ’16 • Steady increase of CLI use and new users
  • 19.
    Angular Roadmap Jan FebMar Apr May Jun Jul Aug Sept Oct Nov Dec Microsoft BUILD ngConf Angular 2 RC {N} ng beta Angular 2 (final) {N} ng (final) AngularConnect (London)
  • 20.
    We have anamazing community!
  • 21.
    Join the growing NativeScript communityon Slack bit.ly/nativescript-slack
  • 22.
    Modulus Sachse ConstructionDay Care This or That! PocketSmith