SlideShare a Scribd company logo
1 of 48
Download to read offline
ANGULAR 2
CORE CONCEPTS
FABIO BIONDI / MATTEO RONCHI2
unshift.xyz
2 ANGULAR 2 CORE CONCEPTS
FABIOBIONDI
UI Developer and Trainer

Sviluppo, formazione e
consulenza su
AngularJS, React,
CreateJS, D3.js e diverse
librerie Javascript.
fabiobiondi.com
2 ANGULAR 2 CORE CONCEPTS
MATTEORONCHI
Senior Software Engineer

Appassionato di
architetture e
ottimizzazioni da poco
aggiunto al team di
Workwave
@cef62
ANGULARCOMMUNITIES
AngularJS Italia
AngularJS Developer Italiani
2 ANGULAR 2 CORE CONCEPTS
• Goodbye $scope
• No more controllers
• Component Based-UI
• 1-way data flow
• ES6 / Typescript
• New built-in directives
ANGULAR 2 VS 1.X
2 ANGULAR 2 CORE CONCEPTS
• New DI system
• Performance
• Better Mobile Support
• Server side render e Native Script
• Embrace Flux and RxJS
• Change Detection System
ANGULAR 2 VS 1.X
COMPONENTFUNDAMENTALS
2 ANGULAR 2 CORE CONCEPTS
Imports
Component Name
selector name <tab-bar/>
Component
Decorator
template
CREATE A WIDGET
2 ANGULAR 2 CORE CONCEPTS
<widget />
<tab-bar />
<map />
Open Plnkr
2 ANGULAR 2 CORE CONCEPTS
Country.ts (model)
Automatically generates
class properties
2 ANGULAR 2 CORE CONCEPTS
Component
Injection
<widget/> (partial)
Component Name
Selector <widget/>
2 ANGULAR 2 CORE CONCEPTS
INPUT PROP
OUTPUT EVENT
INPUT PROP
<widget/> (partial)
2 ANGULAR 2 CORE CONCEPTS
<widget/> (completed)
1
2
3
<map [item]="country">
[…]

INPUT PROPERTY
MAP COMPONENT
ANGULAR 2 CORE CONCEPT2
<map/>
Input property
item:Country

Template Binding
<tab-bar [data]="list"

(onTabSelect)="doIt($event)">
[…]

INPUT PROPERTY
(…)

OUTPUT EVENT
TABBARCOMPONENT
ANGULAR 2 CORE CONCEPT2
1/2
<tab-bar/>
FRAMEWORK

DIRECTIVES
ngFor,ngClass
ANGULAR 2 CORE CONCEPT2
ASSIGN EMITTER
EMIT EVENT
2/2
<tab-bar/>
CURRENT TAB
ANGULARBOOSTRAP
ng.bootstrap(src.Widget)
2 ANGULAR 2 CORE CONCEPTS
1. LOAD LIBRARIES
1/2
index.html
2 ANGULAR 2 CORE CONCEPTS
2. Configure
System.js
3. Bootstrap
2/2
4. DISPLAY <widget/>
index.html
DEPENDENCY INJECTION
2 ANGULAR 2 CORE CONCEPTS
• @injectable to enable injection to services
• Support multiple providers
• Application level injections
• Component level injections
NEW DEPENDENCY INJECTION ENGINE
2 ANGULAR 2 CORE CONCEPTS
import	
  {	
  SubComp	
  }	
  from	
  `./sub-­‐comp`	
  
import	
  {	
  MyHelper	
  }	
  from	
  `./my-­‐helper`	
  
@Component({	
  	
  
template:	
  `<sub-­‐comp></sub-­‐comp>`	
  
directives:	
  [SubComp]	
  
})	
  	
  
class	
  MyComp	
  {	
  
constructor(private	
  helper:	
  MyHelper)	
  {}	
  
}
2 ANGULAR 2 CORE CONCEPTS
Simple Service
export	
  class	
  MyService	
  {	
  
	
  	
  getData()	
  {	
  
	
  	
  	
  	
  return	
  loadData.load();	
  
	
  	
  }	
  
}
2 ANGULAR 2 CORE CONCEPTS
import	
  {Injectable}	
  from	
  ‘angular2/core’;	
  
@Injectable()	
  
export	
  class	
  MyService	
  {	
  
constructor(public	
  loadData:LoadData)	
  {}	
  
	
  	
  getData()	
  {	
  
	
  	
  	
  	
  return	
  loadData.load();	
  
	
  	
  }	
  
}
Inject Service to a Service
COMPONENT LIFECYCLE
2 ANGULAR 2 CORE CONCEPTS
“ Angular only calls a directive/
component hook method if it is
defined. “ [docs]
2 ANGULAR 2 CORE CONCEPTS
BASE HOOKS
(components & directives)
ngOnChanges input property value changes
ngOnInit Initialization step
ngDoCheck every change detection cycle
ngOnDestroy before destruction
2 ANGULAR 2 CORE CONCEPTS
@Directive({selector:	
  '[my-­‐spy]'})	
  
class	
  Spy	
  implements	
  OnInit,	
  OnDestroy	
  {	
  
	
  	
  ngOnInit()	
  {	
  
console.log(`onInit`);	
  
}	
  
	
  	
  ngOnDestroy()	
  {	
  
console.log(`onDestroy`);	
  
}	
  
}
Usage:	
  <div	
  my-­‐spy>...</div>
CHANGE DETECTION
2 ANGULAR 2 CORE CONCEPTS
Angular Application are Data Driven
Data Model Components
2 ANGULAR 2 CORE CONCEPTS
DATA CHANGES -> VIEW UPDATES
Data Model Components
2 ANGULAR 2 CORE CONCEPTS
CHANGE DETECTION
TRAVELS TOP TO BOTTOM
CD
CD CD
CD CDCD
CD CD
ChangeDetection
Flow
2 ANGULAR 2 CORE CONCEPTS
CHANGE DETECTION IS
DEFINED AT COMPONENT LEVEL
2 ANGULAR 2 CORE CONCEPTS
CHANGE DETECTION
CAN SHOULD BE OPTIMIZED
• Immutable Data
• Observable
• Custom BUS Systems …
2 ANGULAR 2 CORE CONCEPTS
@Component({	
  	
  
template:	
  `	
  	
  
<h1>{{user.name}}</h1>	
  	
  
<h3>{{user.nickName}}</h3>	
  `,	
  	
  
changeDetection:	
  ChangeDetectionStrategy.OnPush	
  
inputs:	
  [user]	
  
})	
  	
  
class	
  MyComp	
  {}	
  
Enable Smart Change Detection
2 ANGULAR 2 CORE CONCEPTS
CHANGE DETECTION
WITH IMMUTABLE DATA
CD
CD
CD CD
CD CD
ChangeDetection
Flow
2 ANGULAR 2 CORE CONCEPTS
@Component({	
  	
  
template:	
  `	
  	
  
<h1>{{user.name}}</h1>	
  	
  
<h3>{{user.nickName}}</h3>	
  `,	
  	
  
changeDetection:	
  ChangeDetectionStrategy.OnPush	
  
})	
  	
  
class	
  MyComp	
  {	
  
@Input()	
  user$:Observable<User>;	
  	
  
constructor(private	
  detector:	
  ChangeDetectorRef)	
  {}	
  	
  
ngOnInit()	
  {	
  
this.user$.subscribe((user)	
  =>	
  {	
  	
  
this.user	
  =	
  user;	
  
this.detector.markForCheck();	
  	
  
})	
  	
  
}	
  	
  
}
Change Detection with Observable
2 ANGULAR 2 CORE CONCEPTS
CHANGE DETECTION
WITH OBSERVABLES
CD
CD
CD
CD
ChangeDetection
Flow
WHAT CAUSE
CHANGE DETECTION
2 ANGULAR 2 CORE CONCEPTS
• setTimeout(), setInterval()

• User Events (click, input change..)

• XHR Requests
GET IN THE ZONE
2 ANGULAR 2 CORE CONCEPTS
ZONE.JS INTERCEPTS ALL
ASYNC OPERATIONS

Angular has its own NgZone to
controls Change Detections
THANKS!
MATTEO RONCHI / @cef62
FABIO BIONDI / fabiobiondi.com

More Related Content

What's hot

What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
Ran Wahle
 

What's hot (20)

Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Angular 2 for Java Developers
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
 
An Intro to Angular 2
An Intro to Angular 2An Intro to Angular 2
An Intro to Angular 2
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
Developing a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2IDeveloping a Demo Application with Angular 4 - J2I
Developing a Demo Application with Angular 4 - J2I
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 

Similar to Tech Webinar: Angular 2, Introduction to a new framework

Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
NLJUG
 

Similar to Tech Webinar: Angular 2, Introduction to a new framework (20)

Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
 
Building Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET CoreBuilding Blocks of Angular 2 and ASP.NET Core
Building Blocks of Angular 2 and ASP.NET Core
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
 
Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...
Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...
Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...
 
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember DataIn The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
 
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember DataIn The Trenches With Tomster, Upgrading Ember.js & Ember Data
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
 
Angular 2 overview in 60 minutes
Angular 2 overview in 60 minutesAngular 2 overview in 60 minutes
Angular 2 overview in 60 minutes
 
Architecting Microservices Applications with Instant Analytics
Architecting Microservices Applications with Instant AnalyticsArchitecting Microservices Applications with Instant Analytics
Architecting Microservices Applications with Instant Analytics
 
Kubermatic.pdf
Kubermatic.pdfKubermatic.pdf
Kubermatic.pdf
 
Kubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdfKubermatic CNCF Webinar - start.kubermatic.pdf
Kubermatic CNCF Webinar - start.kubermatic.pdf
 
Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Angular%201%20to%20angular%202
Angular%201%20to%20angular%202
 
Configuration Management Tools on NX-OS
Configuration Management Tools on NX-OSConfiguration Management Tools on NX-OS
Configuration Management Tools on NX-OS
 
QQ And Advance Query
QQ And Advance QueryQQ And Advance Query
QQ And Advance Query
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile Projet d'accès aux résultats des étudiant via client mobile
Projet d'accès aux résultats des étudiant via client mobile
 
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
 

More from Codemotion

More from Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Recently uploaded (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 

Tech Webinar: Angular 2, Introduction to a new framework

  • 1. ANGULAR 2 CORE CONCEPTS FABIO BIONDI / MATTEO RONCHI2 unshift.xyz
  • 2. 2 ANGULAR 2 CORE CONCEPTS FABIOBIONDI UI Developer and Trainer Sviluppo, formazione e consulenza su AngularJS, React, CreateJS, D3.js e diverse librerie Javascript. fabiobiondi.com
  • 3. 2 ANGULAR 2 CORE CONCEPTS MATTEORONCHI Senior Software Engineer Appassionato di architetture e ottimizzazioni da poco aggiunto al team di Workwave @cef62
  • 5. 2 ANGULAR 2 CORE CONCEPTS • Goodbye $scope • No more controllers • Component Based-UI • 1-way data flow • ES6 / Typescript • New built-in directives ANGULAR 2 VS 1.X
  • 6. 2 ANGULAR 2 CORE CONCEPTS • New DI system • Performance • Better Mobile Support • Server side render e Native Script • Embrace Flux and RxJS • Change Detection System ANGULAR 2 VS 1.X
  • 8. 2 ANGULAR 2 CORE CONCEPTS Imports Component Name selector name <tab-bar/> Component Decorator template
  • 10. 2 ANGULAR 2 CORE CONCEPTS <widget /> <tab-bar /> <map /> Open Plnkr
  • 11. 2 ANGULAR 2 CORE CONCEPTS Country.ts (model) Automatically generates class properties
  • 12. 2 ANGULAR 2 CORE CONCEPTS Component Injection <widget/> (partial) Component Name Selector <widget/>
  • 13. 2 ANGULAR 2 CORE CONCEPTS INPUT PROP OUTPUT EVENT INPUT PROP <widget/> (partial)
  • 14. 2 ANGULAR 2 CORE CONCEPTS <widget/> (completed) 1 2 3
  • 16. ANGULAR 2 CORE CONCEPT2 <map/> Input property item:Country
 Template Binding
  • 18. ANGULAR 2 CORE CONCEPT2 1/2 <tab-bar/> FRAMEWORK
 DIRECTIVES ngFor,ngClass
  • 19. ANGULAR 2 CORE CONCEPT2 ASSIGN EMITTER EMIT EVENT 2/2 <tab-bar/> CURRENT TAB
  • 21. 2 ANGULAR 2 CORE CONCEPTS 1. LOAD LIBRARIES 1/2 index.html
  • 22. 2 ANGULAR 2 CORE CONCEPTS 2. Configure System.js 3. Bootstrap 2/2 4. DISPLAY <widget/> index.html
  • 24. 2 ANGULAR 2 CORE CONCEPTS • @injectable to enable injection to services • Support multiple providers • Application level injections • Component level injections NEW DEPENDENCY INJECTION ENGINE
  • 25. 2 ANGULAR 2 CORE CONCEPTS import  {  SubComp  }  from  `./sub-­‐comp`   import  {  MyHelper  }  from  `./my-­‐helper`   @Component({     template:  `<sub-­‐comp></sub-­‐comp>`   directives:  [SubComp]   })     class  MyComp  {   constructor(private  helper:  MyHelper)  {}   }
  • 26. 2 ANGULAR 2 CORE CONCEPTS Simple Service export  class  MyService  {      getData()  {          return  loadData.load();      }   }
  • 27. 2 ANGULAR 2 CORE CONCEPTS import  {Injectable}  from  ‘angular2/core’;   @Injectable()   export  class  MyService  {   constructor(public  loadData:LoadData)  {}      getData()  {          return  loadData.load();      }   } Inject Service to a Service
  • 29. 2 ANGULAR 2 CORE CONCEPTS “ Angular only calls a directive/ component hook method if it is defined. “ [docs]
  • 30. 2 ANGULAR 2 CORE CONCEPTS BASE HOOKS (components & directives) ngOnChanges input property value changes ngOnInit Initialization step ngDoCheck every change detection cycle ngOnDestroy before destruction
  • 31. 2 ANGULAR 2 CORE CONCEPTS @Directive({selector:  '[my-­‐spy]'})   class  Spy  implements  OnInit,  OnDestroy  {      ngOnInit()  {   console.log(`onInit`);   }      ngOnDestroy()  {   console.log(`onDestroy`);   }   } Usage:  <div  my-­‐spy>...</div>
  • 33. 2 ANGULAR 2 CORE CONCEPTS Angular Application are Data Driven Data Model Components
  • 34. 2 ANGULAR 2 CORE CONCEPTS DATA CHANGES -> VIEW UPDATES Data Model Components
  • 35. 2 ANGULAR 2 CORE CONCEPTS CHANGE DETECTION TRAVELS TOP TO BOTTOM CD CD CD CD CDCD CD CD ChangeDetection Flow
  • 36. 2 ANGULAR 2 CORE CONCEPTS CHANGE DETECTION IS DEFINED AT COMPONENT LEVEL
  • 37. 2 ANGULAR 2 CORE CONCEPTS CHANGE DETECTION CAN SHOULD BE OPTIMIZED • Immutable Data • Observable • Custom BUS Systems …
  • 38. 2 ANGULAR 2 CORE CONCEPTS @Component({     template:  `     <h1>{{user.name}}</h1>     <h3>{{user.nickName}}</h3>  `,     changeDetection:  ChangeDetectionStrategy.OnPush   inputs:  [user]   })     class  MyComp  {}   Enable Smart Change Detection
  • 39. 2 ANGULAR 2 CORE CONCEPTS CHANGE DETECTION WITH IMMUTABLE DATA CD CD CD CD CD CD ChangeDetection Flow
  • 40. 2 ANGULAR 2 CORE CONCEPTS @Component({     template:  `     <h1>{{user.name}}</h1>     <h3>{{user.nickName}}</h3>  `,     changeDetection:  ChangeDetectionStrategy.OnPush   })     class  MyComp  {   @Input()  user$:Observable<User>;     constructor(private  detector:  ChangeDetectorRef)  {}     ngOnInit()  {   this.user$.subscribe((user)  =>  {     this.user  =  user;   this.detector.markForCheck();     })     }     } Change Detection with Observable
  • 41. 2 ANGULAR 2 CORE CONCEPTS CHANGE DETECTION WITH OBSERVABLES CD CD CD CD ChangeDetection Flow
  • 43. 2 ANGULAR 2 CORE CONCEPTS • setTimeout(), setInterval() • User Events (click, input change..) • XHR Requests
  • 44. GET IN THE ZONE
  • 45. 2 ANGULAR 2 CORE CONCEPTS ZONE.JS INTERCEPTS ALL ASYNC OPERATIONS Angular has its own NgZone to controls Change Detections
  • 46.
  • 47.
  • 48. THANKS! MATTEO RONCHI / @cef62 FABIO BIONDI / fabiobiondi.com