View/Components Flashcards
If I set a property in a component heroes named hero with a value of ‘Windstorm’ how do I display the value?
One way data binding like so:
<p>{{ hero }}</p>
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?
This is two way data binding, you could include this in your template for an input field:
[(ngModel)]=”hero”
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…
You can use the hero-details selector like and import it into the template like this:
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.
[propety-name]=”Scotty”