read-only
Configures the queries that will be injected into the directive.
Content queries are set before the ngAfterContentInit
callback is
called. View queries are set before the ngAfterViewInit
callback is
called.
Example
@Component(
selector: 'someDir',
queries: const {
'contentChildren': const ContentChildren(ChildDirective),
'viewChildren': const ViewChildren(ChildDirective),
'contentChild': const ContentChild(SingleChildDirective),
'viewChild': const ViewChild(SingleChildDirective)
},
template: '''
<child-directive></child-directive>
<single-child-directive></single-child-directive>
<ng-content></ng-content>
''',
directives: const [ChildDirective, SingleChildDirective])
class SomeDir {
QueryList<ChildDirective> contentChildren;
QueryList<ChildDirective> viewChildren;
SingleChildDirective contentChild;
SingleChildDirective viewChild;
ngAfterContentInit() {
// contentChildren is set
// contentChild is set
}
ngAfterViewInit() {
// viewChildren is set
// viewChild is set
}
}