我想知道在Angular 2中是否有任何方法可以在普通ES6中使用@ViewChild(Class) variable
(使用babel-transform-decorators)?
我已经看到providers
声明中有viewProviders
,queries
和@Component
属性,但我没有运气使用它们。
答案 0 :(得分:1)
您需要使用以下内容:
@Component({
queries: {
variable: new ViewChildren(
Class)
}
})
(...)
此链接可能会让您感兴趣(在“查询装饰器”部分中):