angular-basic-elements Flashcards

1
Q

Structural directives

A

Those are responsible for the page layout. Just like media in html. Structural directives: NgIf, NgFor, NgSwitch.

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

Dependency injection

A

Design pattern which requires instance of class rather than create it.

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

Routing

A
Single page applications with navigation for changing views. 
Application need to have 2 componets at least. And module for routing.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Guard Rouing

A

It checks if the user have the permission to acces the module

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

CLI command in angular to create new component

A

ng g c name-of-component

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

NgClass directive what for is used ?

A
We can add html element classes by using NgClass directive:
----- html -----
 PressME
----- ts -----
elementClasses= {
dimmed : true, 
special : false, 
hidden : true
}

button will belong to classes: dimmed, hidden

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

NgStyle what for is used?

A

NgStyle is used for manipulating styles of the element, the syntax is similar to the NgClass.

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

NgModel what is used for ?

A

Ng model allows us to change data in the html elements, the syntax is more complex, because we need to make [(ngModel)]

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

ngIf

A

*ngIf = “isActive”

directive ngIf allows to show element if the variable is true

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

ngFor

A

*ngFor = “let item of items”

ng for allows to get acces for iterative element in some set using elementwise for.

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

ngSwitch case

A

the name tell us what it does, but the syntax is ugly

<div>
‹div *ngSwitchCase="'Bob'"›Hi dad</div>

<div>Hi Mom
<div>Hi friend</div></div>

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

How to make routing?

A
  1. make app-routing.module
  2. import router in app routing module
  3. define routes in module
  4. set the imports, exports
  5. use the routerLink
  6. use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to pass data during routing?

A

By ActivatedRouter

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