(function(app) {
var ActiveLabelComponent = ng.core.Component({
selector: 'active-label',
template: '' +
'Active' +
''
}).Class({
constructor: function() { },
activate: function() {
this.active = true;
}
});
// #docregion content
var HeroComponent = ng.core.Component({
selector: 'hero',
template: '
' +
'{{hero.name}} ' +
'' +
'
',
inputs: ['hero'],
queries: {
label: new ng.core.ContentChild(
ActiveLabelComponent)
}
}).Class({
constructor: function() { },
activate: function() {
this.active = true;
this.label.activate();
}
});
// #enddocregion content
// #docregion view
var AppComponent = ng.core.Component({
selector: 'heroes-queries',
template:
'' +
'' +
'' +
'',
directives: [
HeroComponent,
ActiveLabelComponent
],
queries: {
heroCmps: new ng.core.ViewChildren(
HeroComponent)
}
}).Class({
constructor: function() {
this.heroData = [
{id: 1, name: 'Windstorm'},
{id: 2, name: 'Superman'}
];
},
activate: function() {
this.heroCmps.forEach(function(cmp) {
cmp.activate();
});
}
});
// #enddocregion view
app.HeroesQueriesComponent = AppComponent;
})(window.app = window.app || {});