angular and json Flashcards

1
Q

Which Angular lifecycle hook is called once when the component is created?

a. ngOnInit()

b. ngOnChanges()

c. ngDoCheck()

d. ngAfterViewInit()

A

a. ngOnInit()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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>

A

b. html

<div *ngFor=”let item of items”>
{{ item }}
</div>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In Angular, which directive is used to conditionally add or remove an element?

a. ngFor

b. ngClass

c. ngStyle

d. ngIf

A

d. ngIf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

c. event binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

c. mat-sidenav

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

d. mat-tab-group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

b. ngAfterViewInit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly