QuerySelector() and QuerySelectorAll()ΒΆ

Decorators @QuerySelector() and @QuerySelectorAll() are syntactic sugar for the @ContentChild(), @ViewChild(), @ContentChildren() and @ViewChildren() decorators.

By default, @QuerySelector() decorator will use @ViewChild() decorator, while @QuerySelectorAll() decorator will use @ViewChildren() decorator.

You may override this behavior by passing { target: 'content' } as second argument to @QuerySelector() or @QuerySelectorAll() decorators, which will make them use @ContentChild() and @ContentChildren() decorators, respectively.

First argument of the decorators is a CSS selector string used to query the element(s) in the DOM subtree of the component (either view or contend child/children). The second optional argument is an object with configuration options for the underlying decorator.