Search code examples
angularangular-decorator

What signifies the @Input decorator on the component property in Angular


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?


Solution

  • @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.