From what I read in the Angular 2 QueryList documentation , @Query should consider the possibility of injecting a reference to a child component in this component.
Using @QueryView I was able to get a link to a child DOM element, for example:
// Parent component template <my-component #test> // Parent component class ParentComponent { constructor(@Query('test') child: QueryList<any>) {...} }
I was expecting @Query to return the corresponding component, not the DOM element, but I was not able to get it to work, and I did not find the documentation that indicates this.
What is the difference between these two decorators?
angular typescript
jaker
source share