View/Components Flashcards

1
Q

If I set a property in a component heroes named hero with a value of ‘Windstorm’ how do I display the value?

A

One way data binding like so:

<p>{{ hero }}</p>

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

Say I have a property in a heroes component name hero with a value of ‘Windstorm’, how can I retrieve the value from the component (display it) and how can I reset the value in the template so it’s modified back in the component? What is this form of data binding called?

A

This is two way data binding, you could include this in your template for an input field:
[(ngModel)]=”hero”

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

I have two components heroes and hero-details, how can I show the content from the hero-details component in the heroes template? Not just copying the code of course…

A

You can use the hero-details selector like and import it into the template like this:

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

How can I simply modify the value of a property in the components template? Opposite from the more common way of one way data binding.

A

[propety-name]=”Scotty”

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