Angular 2 纯 ES6 - 如何声明 ViewChild?

Angular 2 plain ES6 - how to declare ViewChild?

我想知道在 Angular 2 中是否有任何方法可以在纯 ES6 中使用 @ViewChild(Class) variable(使用 babel-transform-decorators)?

我看到 providersviewProvidersqueries 属性在 @Component 声明中,但我没有使用它们。

您需要使用以下内容:

@Component({
  queries: {
    variable: new ViewChildren(
                Class)
  }
})
(...)

这个 link 您可能会感兴趣(在 "Query Decorators" 部分):