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
Slide 3
Slide 3 text
2 ANGULAR 2 CORE CONCEPTS
MATTEORONCHI
Senior Software Engineer
Appassionato di
architetture e
ottimizzazioni da poco
aggiunto al team di
Workwave
@cef62
Slide 4
Slide 4 text
ANGULARCOMMUNITIES
AngularJS Italia
AngularJS Developer Italiani
Slide 5
Slide 5 text
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
Slide 6
Slide 6 text
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
Slide 7
Slide 7 text
COMPONENTFUNDAMENTALS
Slide 8
Slide 8 text
2 ANGULAR 2 CORE CONCEPTS
Imports
Component Name
selector name
Component
Decorator
template
Slide 9
Slide 9 text
COMPONENT COMMUNICATION
Slide 10
Slide 10 text
2 ANGULAR 2 CORE CONCEPTS
Open Plnkr
Slide 11
Slide 11 text
2 ANGULAR 2 CORE CONCEPTS
Country Model
AUTOMATICALLY GENERATES
CLASS PROPERTIES
2 ANGULAR 2 CORE CONCEPTS
Simple Service
export
class
MyService
{
getData()
{
return
loadData.load();
}
}
Slide 25
Slide 25 text
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
Slide 26
Slide 26 text
COMPONENT LIFECYCLE
Slide 27
Slide 27 text
2 ANGULAR 2 CORE CONCEPTS
“ Angular only calls a directive/
component hook method if it is
defined. “ [docs]
Slide 28
Slide 28 text
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