Components Flashcards

1
Q

What is the minimum definition of a component?

A

A class with a Component decorator specifying a template

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

What is the difference between a component and a template?

A

A component is a directive with a template (representing a view)

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

What are different kinds of directives supported in Angular 2?

A

Structural, component, and attribute directives

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

How do components communicate with each other?

A

Various ways - for example: Input/Output properties, services, ViewChild/ViewContent

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

How do you create two way data binding in Angular 2.0?

A

By using the two-way binding syntax [()] (along with ngModel, if you’re doing this in the context of a form control element)

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

How would you create a component to display error messages throughout your application?

A

Implement your own ErrorHandler and configure it in the list of providers for the modules you want it used in

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

How would you support logging in your Angular app?

A

One way would be to use angular2-logger, which is a package inspired by log4j

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

How would you use the ngClass directive?

A

For example:
< div [ngClass]= “ {firstCondition: ‘ class1’ , secondCondition: ‘ class2’ } “ > … < /div >

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

What are dynamic components?

A

Components that are added at runtime (i.e. not fixed). For example, an ad banner component that is determined at runtime

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