SlideShare a Scribd company logo
NativeScript and Angular 2,
Sitting in a Tree
Jen Looper (Telerik DevRel)
@jenlooper
• Ph.D. … in Medieval French (13th
century prose romance FTW)
• Retrained!
• Worked in startup, nonprofit,
big corporate 14 yrs+
• A lot of side projects
ladeezfirstmedia.com
• Now DevRel@Telerik
• I’m a developer & I like mobile apps!
I like NativeScript
Tobias Bosch Hristo Deshev
What is NativeScript?
• A runtime for building and running native iOS,
Android, and (soon) Windows Phone apps with a
single, JavaScript code base
• No cross
compilation
!=
• Direct access to
native APIs in JS
!=
!=
• No DOM
Why NativeScript?
• Skills reuse
• JavaScript and CSS
• Angular2
• Code reuse
• npm modules, 3rd-party iOS and Android libraries
• Easily use native APIs
• No wrappers to access native APIs
• Use native UI elements
• Open source!
• Bridge
NativeScript Android example
Output:
NativeScript iOS example
How does this even?
JavaScript Virtual Machine
But…who wants to write native iOS or
Android code?
NativeScript modules
Code Modules Platform API
2016
NativeScript file module
HTTP module example
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, []);
}
Destination
Implementation
Abstraction
Layer
The big picture
XMLHttpRequest
<NS Module>
Native
iOS call
Native
Android call
iOS App Android App
Destination
Implementation
Abstraction
Layer
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>
One syntax for all
Attribute Binding: [attribute]
Event Binding: (event)
Intercepting input: #idhandler
Conditions: *ng-if="expression"
Loops: *ng-for="expression"
Styling: [class.style1]="expression"
The difference is in the UI
Web UI != Mobile UI
Native Layouts
Absolute Dock Grid Stack Wrap
Let’s take it for a spin!
Use a template to create a sample app:
$ tns create myNewAngularApp --template
https://github.com/NativeScript/template-hello-world-ng
$ tns emulate ios
Clone a repo:
TodoMVC – git clone
https://github.com/NativeScript/sample-ng-todomvc
$ npm install
$ tns platform add ios
$ tns platform add ios
$ tns emulate ios
PocketRave
https://github.com/jlooper/pocketrave-app
Learn more & enjoy!
NativeScript.org
NativeScript Slack Community
http://bit.ly/nativescript-slack
Really useful article: http://bit.ly/n-ng2
@nativescript
@jenlooper

More Related Content

Similar to Angular 2 and NativeScript

Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code Camp
Baskar rao Dsn
 
Game On With NativeScript
Game On With NativeScriptGame On With NativeScript
Game On With NativeScript
Jen Looper
 
Introduction to MonoTouch and Monodroid/Mono for Android
Introduction to MonoTouch and Monodroid/Mono for AndroidIntroduction to MonoTouch and Monodroid/Mono for Android
Introduction to MonoTouch and Monodroid/Mono for Android
Chris Hardy
 
Native script overview
Native script overviewNative script overview
Native script overview
Baskar rao Dsn
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
Ulrich Krause
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
Oliver N
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
Doris Chen
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
Domenic Denicola
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
John M. Wargo
 
React Native
React NativeReact Native
React Native
Heber Silva
 
Kirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UIKirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UI
jhugman
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Gil Irizarry
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
Paul Jensen
 
The Javascript Ecosystem
The Javascript EcosystemThe Javascript Ecosystem
The Javascript Ecosystem
Emmanuel Akinde
 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Bala Subra
 
Node azure
Node azureNode azure
Node azure
Emanuele DelBono
 
Native script overview
Native script overviewNative script overview
Native script overview
Baskar rao Dsn
 
Cross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScriptCross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScript
Fokke Zandbergen
 

Similar to Angular 2 and NativeScript (20)

Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code Camp
 
Game On With NativeScript
Game On With NativeScriptGame On With NativeScript
Game On With NativeScript
 
Introduction to MonoTouch and Monodroid/Mono for Android
Introduction to MonoTouch and Monodroid/Mono for AndroidIntroduction to MonoTouch and Monodroid/Mono for Android
Introduction to MonoTouch and Monodroid/Mono for Android
 
Native script overview
Native script overviewNative script overview
Native script overview
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
 
React Native
React NativeReact Native
React Native
 
Kirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UIKirin - Making Single Page Web Apps with a Native UI
Kirin - Making Single Page Web Apps with a Native UI
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
The Javascript Ecosystem
The Javascript EcosystemThe Javascript Ecosystem
The Javascript Ecosystem
 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
 
Node azure
Node azureNode azure
Node azure
 
Native script overview
Native script overviewNative script overview
Native script overview
 
Cross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScriptCross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScript
 

More from Jen Looper

Computer Science for Kids: A Storytelling Approach
Computer Science for Kids: A Storytelling ApproachComputer Science for Kids: A Storytelling Approach
Computer Science for Kids: A Storytelling Approach
Jen Looper
 
Staying Fresh and Avoiding Burnout
Staying Fresh and Avoiding BurnoutStaying Fresh and Avoiding Burnout
Staying Fresh and Avoiding Burnout
Jen Looper
 
Sharing Code between Web and Mobile Apps
Sharing Code between Web and Mobile AppsSharing Code between Web and Mobile Apps
Sharing Code between Web and Mobile Apps
Jen Looper
 
Beacons, Plants, Boxes
Beacons, Plants, BoxesBeacons, Plants, Boxes
Beacons, Plants, Boxes
Jen Looper
 
Hackathon Slides
Hackathon SlidesHackathon Slides
Hackathon Slides
Jen Looper
 
Using Beacons in a Mobile App - IoT Nearables
Using Beacons in a Mobile App - IoT NearablesUsing Beacons in a Mobile App - IoT Nearables
Using Beacons in a Mobile App - IoT Nearables
Jen Looper
 
Swipe Left for NativeScript
Swipe Left for NativeScriptSwipe Left for NativeScript
Swipe Left for NativeScript
Jen Looper
 
Crafting an Adventure: The Azure Maya Mystery
Crafting an Adventure: The Azure Maya MysteryCrafting an Adventure: The Azure Maya Mystery
Crafting an Adventure: The Azure Maya Mystery
Jen Looper
 
Re-Building a Tech Community - Post Pandemic!
Re-Building a Tech Community - Post Pandemic!Re-Building a Tech Community - Post Pandemic!
Re-Building a Tech Community - Post Pandemic!
Jen Looper
 
Building a Tech Community in Ten Easy Steps
Building a Tech Community in Ten Easy StepsBuilding a Tech Community in Ten Easy Steps
Building a Tech Community in Ten Easy Steps
Jen Looper
 
Becoming a Green Developer
Becoming a Green DeveloperBecoming a Green Developer
Becoming a Green Developer
Jen Looper
 
Azure Static Web Apps
Azure Static Web AppsAzure Static Web Apps
Azure Static Web Apps
Jen Looper
 
Creating a Great Workshop
Creating a Great WorkshopCreating a Great Workshop
Creating a Great Workshop
Jen Looper
 
The Ethics of Generative AI: A Humanist's Guide
The Ethics of Generative AI: A Humanist's GuideThe Ethics of Generative AI: A Humanist's Guide
The Ethics of Generative AI: A Humanist's Guide
Jen Looper
 
Zero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. StackZero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. Stack
Jen Looper
 
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXTTelerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Jen Looper
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
Jen Looper
 

More from Jen Looper (17)

Computer Science for Kids: A Storytelling Approach
Computer Science for Kids: A Storytelling ApproachComputer Science for Kids: A Storytelling Approach
Computer Science for Kids: A Storytelling Approach
 
Staying Fresh and Avoiding Burnout
Staying Fresh and Avoiding BurnoutStaying Fresh and Avoiding Burnout
Staying Fresh and Avoiding Burnout
 
Sharing Code between Web and Mobile Apps
Sharing Code between Web and Mobile AppsSharing Code between Web and Mobile Apps
Sharing Code between Web and Mobile Apps
 
Beacons, Plants, Boxes
Beacons, Plants, BoxesBeacons, Plants, Boxes
Beacons, Plants, Boxes
 
Hackathon Slides
Hackathon SlidesHackathon Slides
Hackathon Slides
 
Using Beacons in a Mobile App - IoT Nearables
Using Beacons in a Mobile App - IoT NearablesUsing Beacons in a Mobile App - IoT Nearables
Using Beacons in a Mobile App - IoT Nearables
 
Swipe Left for NativeScript
Swipe Left for NativeScriptSwipe Left for NativeScript
Swipe Left for NativeScript
 
Crafting an Adventure: The Azure Maya Mystery
Crafting an Adventure: The Azure Maya MysteryCrafting an Adventure: The Azure Maya Mystery
Crafting an Adventure: The Azure Maya Mystery
 
Re-Building a Tech Community - Post Pandemic!
Re-Building a Tech Community - Post Pandemic!Re-Building a Tech Community - Post Pandemic!
Re-Building a Tech Community - Post Pandemic!
 
Building a Tech Community in Ten Easy Steps
Building a Tech Community in Ten Easy StepsBuilding a Tech Community in Ten Easy Steps
Building a Tech Community in Ten Easy Steps
 
Becoming a Green Developer
Becoming a Green DeveloperBecoming a Green Developer
Becoming a Green Developer
 
Azure Static Web Apps
Azure Static Web AppsAzure Static Web Apps
Azure Static Web Apps
 
Creating a Great Workshop
Creating a Great WorkshopCreating a Great Workshop
Creating a Great Workshop
 
The Ethics of Generative AI: A Humanist's Guide
The Ethics of Generative AI: A Humanist's GuideThe Ethics of Generative AI: A Humanist's Guide
The Ethics of Generative AI: A Humanist's Guide
 
Zero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. StackZero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. Stack
 
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXTTelerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
Telerik AppBuilder, Estimote Beacons, and the IoT - Presentation for TelerikNEXT
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 

Recently uploaded

H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 

Recently uploaded (20)

H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 

Angular 2 and NativeScript

  • 1. NativeScript and Angular 2, Sitting in a Tree Jen Looper (Telerik DevRel) @jenlooper
  • 2. • Ph.D. … in Medieval French (13th century prose romance FTW) • Retrained! • Worked in startup, nonprofit, big corporate 14 yrs+ • A lot of side projects ladeezfirstmedia.com • Now DevRel@Telerik
  • 3. • I’m a developer & I like mobile apps!
  • 5.
  • 7.
  • 8. What is NativeScript? • A runtime for building and running native iOS, Android, and (soon) Windows Phone apps with a single, JavaScript code base
  • 9.
  • 10. • No cross compilation != • Direct access to native APIs in JS != != • No DOM
  • 11. Why NativeScript? • Skills reuse • JavaScript and CSS • Angular2 • Code reuse • npm modules, 3rd-party iOS and Android libraries • Easily use native APIs • No wrappers to access native APIs • Use native UI elements • Open source!
  • 15.
  • 16. How does this even?
  • 18.
  • 19. But…who wants to write native iOS or Android code?
  • 20.
  • 24. 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!!
  • 25. 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!" }); };
  • 26. 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, []); }
  • 27. Destination Implementation Abstraction Layer The big picture XMLHttpRequest <NS Module> Native iOS call Native Android call iOS App Android App
  • 28. Destination Implementation Abstraction Layer 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>
  • 29. One syntax for all Attribute Binding: [attribute] Event Binding: (event) Intercepting input: #idhandler Conditions: *ng-if="expression" Loops: *ng-for="expression" Styling: [class.style1]="expression"
  • 30. The difference is in the UI Web UI != Mobile UI
  • 31. Native Layouts Absolute Dock Grid Stack Wrap
  • 32. Let’s take it for a spin! Use a template to create a sample app: $ tns create myNewAngularApp --template https://github.com/NativeScript/template-hello-world-ng $ tns emulate ios
  • 33. Clone a repo: TodoMVC – git clone https://github.com/NativeScript/sample-ng-todomvc $ npm install $ tns platform add ios $ tns platform add ios $ tns emulate ios PocketRave https://github.com/jlooper/pocketrave-app
  • 34. Learn more & enjoy! NativeScript.org NativeScript Slack Community http://bit.ly/nativescript-slack Really useful article: http://bit.ly/n-ng2 @nativescript @jenlooper