I am currently creating a @viewChild component, tabs in my app. However, upon inserting the following lines:
@ViewChild('tabs') tabs: IonTabs;
I am facing an error 'Expected 2 arguments, but got 1.'
Please helps. Thks!
I am currently creating a @viewChild component, tabs in my app. However, upon inserting the following lines:
@ViewChild('tabs') tabs: IonTabs;
I am facing an error 'Expected 2 arguments, but got 1.'
Please helps. Thks!
You have to configure the static property in Metadata Properties (From Angular 8 onwards).
@ViewChild('tabs', {static: false}) tabs: IonTabs;
static property should be set true to resolve query results before change detection runs and false for depending on binding resolution (Structural directives *ngIf, *ngFor,...) for query resolution.
{static: false} will be used in most cases ensuring that query will be resolved after change detection runs.
The {static: false} is going to be the default fallback in Angular 9.
You can read more here: https://angular.io/api/core/ViewChild#description