SlideShare a Scribd company logo
1 of 49
Download to read offline
ANGULAR 2 PRE-WORKSHOP
Register in Slack “Open Web Uruguay” http://owu.herokuapp.com/
Channel #jsconfuy-angular2
Channel
Requirements Run
● $ ng new music
● $ cd music
1. NodeJS >= 4.0.0
2. Angular CLI
$ npm install -g angular-cli@0.0.30
WHERE
Antel, Guatemala 1075,
Montevideo, Uruguay
Greetings,
ONLINE
Web: https://angular2-jsconf.herokuapp.com/
ANGULAR 2
JSCONF WORKSHOP
with Iran Reyes & Santiago Ferreira
@iranfleitas @san650
Speakers
@matias_delgado @vlavella19
Collaborators
@sebasrodriguez
Table of Content
1. Angular 2
2. angular-cli
3. Base template
4. Components and binding
5. Consuming data
6. Routing
7. Services
ANGULAR 2
● Framework JS by Google (back to 7 years ago)
● Closer to Web Standards
● ES5 / ES6 / Typescript / Dart
● Faster, Semantically better, Easy, ...
MUSIC
ANGULAR-CLI
GUIDELINE
● Generators (Blueprints)
● Project structure based on conventions
● Test runner
● Development server
● Addons
● Deploys and other stuff…
ANGULAR-CLI
ANGULAR-CLI
● $ npm install -g angular-cli@0.0.30
● $ ng new music/
● $ cd music/
● $ ng server (en otra consola)
GUIDELINE
● Generators (Blueprints)
● Project structure based on conventions
● Test runner
● Development server
● Addons
● Deploys and other stuff…
BASE TEMPLATE
BASE TEMPLATE
GUIDELINE
● Templates files (.html)
● Global stylesheets
BASE TEMPLATE
1. Copy https://s3-sa-east-1.amazonaws.com/ng-music/templates/music.html
to src/client/app/music.html
2. Add reference to https://ng-music.s3-sa-east-1.amazonaws.com/app.css
in src/client/index.html
<link href="https://ng-music.s3-sa-east-1.amazonaws.com/app.css" rel="stylesheet">
GUIDELINE
● Templates files (.html)
● Global stylesheets
COMPONENTS AND
BINDING
COMPONENTS AND BINDING
GUIDELINE
Components
● Generate components
● Include components on other components
Binding
● one-way bindings using [...] notation
● define events using (...) notation
COMPONENTS AND BINDING
<albums-page> component
1. $ ng generate component albums-page
2. Cut/paste albums-page HTML into music/src/client/app/albums-page/albums-page.html
3. Import AlbumsPage from music/src/client/app/music.ts
4. Register AlbumsPage component as a directive
5. Use <albums-page> component in music/src/client/app/music.html template
COMPONENTS AND BINDING
<album-cover> component
1. $ ng generate component album-cover
2. Cut/paste album-cover HTML into music/src/client/app/album-cover/album-cover.html
3. Import AlbumCover from music/src/client/app/albums-page/albums-page.ts
4. Register AlbumCover component as a directive
5. Use <album-cover> component in music/src/client/app/albums-page/albums-page.html
COMPONENTS AND BINDING
Binding
1. Create dummy album on music/src/client/app/album-cover/album-cover.ts
2. Use [alt]= and [src]= notation to bind attributes
3. Use {{album.artist}} to render text on screen
4. Use (click)= notation to listen to events
GUIDELINE
Components
● Generate components
● Include components on other components
Binding
● one-way bindings using [...] notation
● define events using (...) notation
CONSUMING DATA
CONSUMING DATA
● HTTP Service
● Fetch resources from external source
● Iterate over resources using *ngFor directive
● Know about input and output properties
GUIDELINE
CONSUMING DATA
Fetch all albums
1. Import and register HTTP_PROVIDERS and Http class on AlbumsPage
component
2. Fetch all albums on AlbumsPage constructor
3. Restart server to proxy HTTP requests
4. $ ng server --proxy http://em-ng-workshop.herokuapp.com/
CONSUMING DATA
Render all albums
1. Import and register NgFor directive on AlbumsPage component
import {NgFor} from 'angular2/common';
2. Iterate over all albums on AlbumsPage template
<album-cover *ngFor="#album of albums" [album]="album"></album-cover>
CONSUMING DATA
Use “album” attribute
1. Import Input decorator on AlbumCover component
import {Input,Component} from 'angular2/core';
2. Decorate album property
@Input() album: any;
3. Remove dummy album definition
● HTTP Service
● Fetch resources from external source
● Iterate over resources using *ngFor directive
● Know about input and output properties
GUIDELINE
ROUTING
ROUTING
● @RouteConfig
● <router-outlet>
● [router-link]
GUIDELINE
ROUTING
<tracks-page> component
1. $ ng generate component tracks-page
2. copy https://s3-sa-east-1.amazonaws.com/ng-music/templates/album.html to
music/src/client/app/tracks-page/tracks-page.html
3. Import TracksPage from music/src/client/app/music.ts
4. Remove <albums-page /> component from music/src/client/app/music.html
template
ROUTING
@RouteConfig
1. Register in music/src/app/music.ts components in @RouteConfig
{ path: '/', component: AlbumsPage, name: 'AlbumsPage' },
{ path: '/:id', component: TracksPage, name: 'TracksPage' }
ROUTING
Link to go to /:id
1. Import and register routerLink directive on AlbumCover
import {RouterLink} from 'angular2/router';
2. Update AlbumCover template to add a link to TracksPage
<a [routerLink]="['TracksPage', { id: album.id }]">
3. Remove unneeded (click) event handler
ROUTING
Link to go back to /
1. Update Music template to add a link to AlbumsPage
<a [routerLink]="['AlbumsPage']" class="...">
<span>Albums</span>
</a>
● @RouteConfig
● <router-outlet>
● [router-link]
GUIDELINE
SERVICES
SERVICES
● Application-wide state
● Data store
GUIDELINE
SERVICES
1. $ ng generate service albums-service
1. Move /api/albums query to Albums service
2. Import Http from albums-service/albums-service.ts
3. Also import map: import 'rxjs/add/operator/map';
4. Create a method call getAllAlbums and return the albums
SERVICES
1. Import AlbumsService from albums-page/albums-page.ts
2. Add AlbumsService to the providers in AlbumsPage
3. Inject AlbumsService to the constructor of AlbumsPage
4. Subscribe from AlbumsService for changes
5. Add HTTP_PROVIDERS to music.ts
● Application-wide state
● Data store
GUIDELINE
QUESTIONS?
ANGULAR 2 JSCONF WORKSHOP

More Related Content

Viewers also liked

Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type scriptRavi Mone
 
How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!Nir Kaufman
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready Nir Kaufman
 
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...Codemotion
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Dawid Myslak
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Codemotion
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshopNir Kaufman
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core ConceptsFabio Biondi
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Knoldus Inc.
 
Getting Started with Angular 2
Getting Started with Angular 2Getting Started with Angular 2
Getting Started with Angular 2FITC
 

Viewers also liked (16)

Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
React JS
React JSReact JS
React JS
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
Angular2
Angular2Angular2
Angular2
 
How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
 
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Angular 2 - Better or worse
Angular 2 - Better or worseAngular 2 - Better or worse
Angular 2 - Better or worse
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
Understanding Angular 2 - Shmuela Jacobs - Codemotion Milan 2016
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Getting Started with Angular 2
Getting Started with Angular 2Getting Started with Angular 2
Getting Started with Angular 2
 

Similar to ANGULAR 2 JSCONF WORKSHOP

Building Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptBuilding Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptMSDEVMTL
 
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016Manfred Steyer
 
Angular + Components
Angular + ComponentsAngular + Components
Angular + ComponentsShawn McKay
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Matt Raible
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui frameworkHongSeong Jeon
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Naveen Pete
 
HotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePushHotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePushEvan Schultz
 
Automatic Discovery of Service Metadata for Systems at Scale
Automatic Discovery of Service Metadata for Systems at ScaleAutomatic Discovery of Service Metadata for Systems at Scale
Automatic Discovery of Service Metadata for Systems at ScaleMartina Iglesias Fernández
 
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...Denis_infinum
 
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...Infinum
 
Building ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsBuilding ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsColdFusionConference
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2A.K.M. Ahsrafuzzaman
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopVivek Krishnakumar
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdfsagarpal60
 
Kubernetes walkthrough
Kubernetes walkthroughKubernetes walkthrough
Kubernetes walkthroughSangwon Lee
 
Peggy angular 2 in meteor
Peggy   angular 2 in meteorPeggy   angular 2 in meteor
Peggy angular 2 in meteorLearningTech
 
Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework BasicMario Romano
 

Similar to ANGULAR 2 JSCONF WORKSHOP (20)

Building Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptBuilding Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScript
 
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016
The newst new Router for Angular 2 - Talk at @angular_berlin, July 2016
 
Angular + Components
Angular + ComponentsAngular + Components
Angular + Components
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
SAKHIB HUSSAIN PPT 2.pptx
SAKHIB HUSSAIN PPT 2.pptxSAKHIB HUSSAIN PPT 2.pptx
SAKHIB HUSSAIN PPT 2.pptx
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
HotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePushHotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePush
 
Automatic Discovery of Service Metadata for Systems at Scale
Automatic Discovery of Service Metadata for Systems at ScaleAutomatic Discovery of Service Metadata for Systems at Scale
Automatic Discovery of Service Metadata for Systems at Scale
 
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an Android archive (.aar) to Maven...
 
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...
Infinum Android Talks #04 - How to publish an android archive (.aar) to Maven...
 
Building ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsBuilding ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS Applications
 
Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2Ride on the Fast Track of Web with Ruby on Rails- Part 2
Ride on the Fast Track of Web with Ruby on Rails- Part 2
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdf
 
Angular routing
Angular routingAngular routing
Angular routing
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Kubernetes walkthrough
Kubernetes walkthroughKubernetes walkthrough
Kubernetes walkthrough
 
Peggy angular 2 in meteor
Peggy   angular 2 in meteorPeggy   angular 2 in meteor
Peggy angular 2 in meteor
 
Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
 

Recently uploaded

VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escortsindian call girls near you
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 

Recently uploaded (20)

VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Vip Call Girls Aerocity ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Aerocity ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Aerocity ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Aerocity ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 

ANGULAR 2 JSCONF WORKSHOP

  • 1. ANGULAR 2 PRE-WORKSHOP Register in Slack “Open Web Uruguay” http://owu.herokuapp.com/ Channel #jsconfuy-angular2 Channel Requirements Run ● $ ng new music ● $ cd music 1. NodeJS >= 4.0.0 2. Angular CLI $ npm install -g angular-cli@0.0.30
  • 2. WHERE Antel, Guatemala 1075, Montevideo, Uruguay Greetings, ONLINE Web: https://angular2-jsconf.herokuapp.com/ ANGULAR 2 JSCONF WORKSHOP with Iran Reyes & Santiago Ferreira
  • 5.
  • 6.
  • 7. Table of Content 1. Angular 2 2. angular-cli 3. Base template 4. Components and binding 5. Consuming data 6. Routing 7. Services
  • 8. ANGULAR 2 ● Framework JS by Google (back to 7 years ago) ● Closer to Web Standards ● ES5 / ES6 / Typescript / Dart ● Faster, Semantically better, Easy, ...
  • 11. GUIDELINE ● Generators (Blueprints) ● Project structure based on conventions ● Test runner ● Development server ● Addons ● Deploys and other stuff…
  • 13. ANGULAR-CLI ● $ npm install -g angular-cli@0.0.30 ● $ ng new music/ ● $ cd music/ ● $ ng server (en otra consola)
  • 14. GUIDELINE ● Generators (Blueprints) ● Project structure based on conventions ● Test runner ● Development server ● Addons ● Deploys and other stuff…
  • 17. GUIDELINE ● Templates files (.html) ● Global stylesheets
  • 18. BASE TEMPLATE 1. Copy https://s3-sa-east-1.amazonaws.com/ng-music/templates/music.html to src/client/app/music.html 2. Add reference to https://ng-music.s3-sa-east-1.amazonaws.com/app.css in src/client/index.html <link href="https://ng-music.s3-sa-east-1.amazonaws.com/app.css" rel="stylesheet">
  • 19. GUIDELINE ● Templates files (.html) ● Global stylesheets
  • 22. GUIDELINE Components ● Generate components ● Include components on other components Binding ● one-way bindings using [...] notation ● define events using (...) notation
  • 23. COMPONENTS AND BINDING <albums-page> component 1. $ ng generate component albums-page 2. Cut/paste albums-page HTML into music/src/client/app/albums-page/albums-page.html 3. Import AlbumsPage from music/src/client/app/music.ts 4. Register AlbumsPage component as a directive 5. Use <albums-page> component in music/src/client/app/music.html template
  • 24. COMPONENTS AND BINDING <album-cover> component 1. $ ng generate component album-cover 2. Cut/paste album-cover HTML into music/src/client/app/album-cover/album-cover.html 3. Import AlbumCover from music/src/client/app/albums-page/albums-page.ts 4. Register AlbumCover component as a directive 5. Use <album-cover> component in music/src/client/app/albums-page/albums-page.html
  • 25. COMPONENTS AND BINDING Binding 1. Create dummy album on music/src/client/app/album-cover/album-cover.ts 2. Use [alt]= and [src]= notation to bind attributes 3. Use {{album.artist}} to render text on screen 4. Use (click)= notation to listen to events
  • 26. GUIDELINE Components ● Generate components ● Include components on other components Binding ● one-way bindings using [...] notation ● define events using (...) notation
  • 29. ● HTTP Service ● Fetch resources from external source ● Iterate over resources using *ngFor directive ● Know about input and output properties GUIDELINE
  • 30. CONSUMING DATA Fetch all albums 1. Import and register HTTP_PROVIDERS and Http class on AlbumsPage component 2. Fetch all albums on AlbumsPage constructor 3. Restart server to proxy HTTP requests 4. $ ng server --proxy http://em-ng-workshop.herokuapp.com/
  • 31. CONSUMING DATA Render all albums 1. Import and register NgFor directive on AlbumsPage component import {NgFor} from 'angular2/common'; 2. Iterate over all albums on AlbumsPage template <album-cover *ngFor="#album of albums" [album]="album"></album-cover>
  • 32. CONSUMING DATA Use “album” attribute 1. Import Input decorator on AlbumCover component import {Input,Component} from 'angular2/core'; 2. Decorate album property @Input() album: any; 3. Remove dummy album definition
  • 33. ● HTTP Service ● Fetch resources from external source ● Iterate over resources using *ngFor directive ● Know about input and output properties GUIDELINE
  • 36. ● @RouteConfig ● <router-outlet> ● [router-link] GUIDELINE
  • 37. ROUTING <tracks-page> component 1. $ ng generate component tracks-page 2. copy https://s3-sa-east-1.amazonaws.com/ng-music/templates/album.html to music/src/client/app/tracks-page/tracks-page.html 3. Import TracksPage from music/src/client/app/music.ts 4. Remove <albums-page /> component from music/src/client/app/music.html template
  • 38. ROUTING @RouteConfig 1. Register in music/src/app/music.ts components in @RouteConfig { path: '/', component: AlbumsPage, name: 'AlbumsPage' }, { path: '/:id', component: TracksPage, name: 'TracksPage' }
  • 39. ROUTING Link to go to /:id 1. Import and register routerLink directive on AlbumCover import {RouterLink} from 'angular2/router'; 2. Update AlbumCover template to add a link to TracksPage <a [routerLink]="['TracksPage', { id: album.id }]"> 3. Remove unneeded (click) event handler
  • 40. ROUTING Link to go back to / 1. Update Music template to add a link to AlbumsPage <a [routerLink]="['AlbumsPage']" class="..."> <span>Albums</span> </a>
  • 41. ● @RouteConfig ● <router-outlet> ● [router-link] GUIDELINE
  • 44. ● Application-wide state ● Data store GUIDELINE
  • 45. SERVICES 1. $ ng generate service albums-service 1. Move /api/albums query to Albums service 2. Import Http from albums-service/albums-service.ts 3. Also import map: import 'rxjs/add/operator/map'; 4. Create a method call getAllAlbums and return the albums
  • 46. SERVICES 1. Import AlbumsService from albums-page/albums-page.ts 2. Add AlbumsService to the providers in AlbumsPage 3. Inject AlbumsService to the constructor of AlbumsPage 4. Subscribe from AlbumsService for changes 5. Add HTTP_PROVIDERS to music.ts
  • 47. ● Application-wide state ● Data store GUIDELINE