@Component({
selector:'greeter',
template:`
<div>
Your name:
<input #name>
<br>
{{greeting}}
</div>
`
})
class Greeter { greeting:string = 'Hello';}
viewA = new View({
template: ...,
context: new Greeter(),
localVars: ['name'],
watchExp : ['greeting']
});
@Component({
selector:'greeter',
template:`
<div>
Your name:<input #name>
{{greeting}}
</div>
`
})
class Greeter { greeting:string = 'Hello';}
var greeter =
new Locals(
new Greeter(), {
name: input_element
})
During the resolution of the expressions we
first check the locals, and then the Greeter
instance.
Count: {{items.length}}
<ul>
<template ngFor var-item [ngForOf]="items">
<li>{{item}}</li>
</template>
</ul>
Count: 2
<ul>
<template view-container-ref></template>
<li>first</li>
<li>second</li>
</ul>
<div> | viewA
<my-component> | viewA
#SHADOW_ROOT | (encapsulation boundary)
<div> | viewB
encapsulated rendering | viewB
</div> | viewB
</my-component> | viewA
</div> | viewA
Developer guides
Angular code source
Angular 2.0 Views

Angular 2.0 Views