angular and json Flashcards
Which Angular lifecycle hook is called once when the component is created?
a. ngOnInit()
b. ngOnChanges()
c. ngDoCheck()
d. ngAfterViewInit()
a. ngOnInit()
What is the correct syntax for using ngFor to repeat a list of items in Angular?
a. html
<div>
{{ item }}
</div>
b. html
<div *ngFor=”let item of items”>
{{ item }}
</div>
c. html
<div>
{{ item }}
</div>
d. html
<div *ng-repeat=”item in items”>
{{ item }}
</div>
b. html
<div *ngFor=”let item of items”>
{{ item }}
</div>
In Angular, which directive is used to conditionally add or remove an element?
a. ngFor
b. ngClass
c. ngStyle
d. ngIf
d. ngIf
In Angular, which binding type allows us to listen for and respond to user events?
a. property binding
b. interpolation binding
c. event binding
d. two-way binding
c. event binding
Which Angular Material component is used to create a responsive navigation menu?
a. mat-toolbar
b. mat-menu
c. mat-sidenav
d. mat-grid-list
c. mat-sidenav
Which Angular Material component is used to display a tabbed navigation interface?
a. mat-nav
b. mat-toolbar
c. mat-sidenav
d. mat-tab-group
d. mat-tab-group
Which lifecycle hook in Angular is called after Angular initializes the component’s views and child views?
a. ngOnInit
b. ngAfterViewInit
c. ngDoCheck
d. ngAfterContentInit
b. ngAfterViewInit