Nested components Flashcards

1
Q

How many was to use a component?

A

Two. As a directive or as a routing target.

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

Component can be nested if

A

it has a selector so it can be used. It can optionally communicate with its container

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

How nested component receives information from container

A

By using @Input properties

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

Nested component outputs information to the container by … ?

A

emitting events

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

@Input decorator can decorate any property in nested component. How does container pass data to nested component?

A

By property binding.

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

When does the ngOnChanges event of nested component is generated?

A

Any time the container data changes and is bound to @Input property of the nested component.

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

@Output decorator decorates

A

any property of the nested component class. Property must be an event. This is the only way a nested component can pass data to the container.

The way to do is for example to setup an event, that by itself emits event to container. onClick() { this.notify.emit(…); }

Then on the container HTML when calling the directive use event binding (notify)=’onNotify($event)’ to call a method in container component.

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

Pluralsight courses to check out

A

Angular component communication

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