Reputation: 2776
In The component I found the @Input
decorator attached to the property
@Input() description: string;
the property description is used in the html as the interpolation
<div>{{description}}</div>
The question is what signifies the @Input
? when and why it is used?
Upvotes: 1
Views: 453
Reputation: 33
The @Input
decorator signifies that the component property is available for view binding.
The power of the angular binding infrastructure allows us to use any component property as a bindable property by attaching the @Input
decorator to it.
Upvotes: 1
Reputation: 61379
@Input
means that a consuming component can set/bind the property like so:
<my-comp [description]="someProperty"></my-comp>
It does not affect the ability for the component itself to use the property. Similarly @Output
signifies an event that can be subscribed to.
Upvotes: 2