17.10.2018 Views

Angular

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

Section 49.2: Simple example of Input Properties<br />

Parent element html<br />

<br />

Parent element ts<br />

export class AppComponent {<br />

inputPropValue: true<br />

}<br />

Child component ts:<br />

export class ChildComponent {<br />

@Input() inputPropValue = false;<br />

}<br />

Child component html:<br />

<br />

This code will send the inputPropValue from the parent component to the child and it will have the value we have<br />

set in the parent component when it arrives there - false in our case. We can then use that value in the child<br />

component to, for example add a class to an element.<br />

GoalKicker.com – <strong>Angular</strong> 2 Notes for Professionals 169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!