Here is an article which shows how to access ViewChildren and ContentChildren in TypeScript. How to access the same if Angular 2 code is written in ES5?
You need to use ng.core.ViewChildren into the queries attribute of ng.core.Component.
Here is sample:
var component = ng.core
.Component({
selector: 'comp',
template: '...',
(...)
queries: {
someProp: new ng.core.ViewChildren(someDirective)
}
})
.Class({
(...)
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.