Agenda
- Architecture Overview
- Shadow DOM
- Dependency Injection
- Decorator
- Component interaction
-
Change Detection
- zone, immutable, observable
- Q & A
- Coding time
- Module
- Component
- Template
- Metadata
- Data Binding
- Service
- Directive
- Dependency Injection
Shadow DOM
Shadow DOM is part of the Web Components standard and enables DOM tree and style encapsulation.
Available since Chrome 35+
Web Component
- Shadow DOM
- Template
- Custom Element
- Packaging
-
ViewEncapsulation.NoneNo Shadow DOM at all. Therefore, also no style encapsulation.
- ViewEncapsulation.EmulatedNo Shadow DOM but style encapsulation emulation.
- ViewEncapsulation.NativeNative Shadow DOM with all it’s goodness.
Questions:
- SEO
- Global styles sharing
Constructor injection
@Component({
providers: [HeroService]
})
export class AppComponent {
constructor(private _heroService: HeroService) { }
}
Hierarchical injectors
@Component({
providers: []
})
export class HeroComponent {
constructor(private _heroService: HeroService) { }
}
Decorator
@Component({
selector: 'my-app',
template:`
{{title}}
My Heroes
`,
styles:[`
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 10em;
}
`]
})
export class AppComponent {
...
- Parent <-> Children
- Space-travel
Two Phases
Developer is responsible for updating the application model.
Angular is responsible for reflecting the state of the model in the view.
(The framework does it automatically on every VM turn.)
- TTL === 1(0)
- immutable
- observable
- zone.js
Angular 2.0 Overview
angular 2.0 series 1
By sxia - https://github.com/jiubao