Components Flashcards

1
Q

Where do you define a component?

A

Inside a class ex:

export class HeroListComponent implements OnInit {
}

hero-list.component.ts

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

What does the component do?

A

Controls a patch on the screen called view

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

What is two way data binding and how does it work?

A

A mechanism for coordinating the parts of a template with the parts of a component. It works by adding binding markup to the template HTML

https://angular.io/generated/images/guide/architecture/databinding.png

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

How do directives affect the page?

A
It transforms the DOM according  to the instructions given by the directives.
Directive is a class is @Directive decorator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the two types of directives?

A

Structural and Attribute

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

Why do we need structural directives?

A

Weed need them for manipulating the layout of the page by adding, removing and replacing elements in the DOM

Ex:

<li>
</li>

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

How does an attribute directive works?

A

They alter the appearance or behavior of an existing element. They look like HTML elements

ngModel directive

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