- To mark the field as input property so that it can be used in property binding
Option 1:
- Input decorator is used to mark field and properties as input properties
- Preferred way
- import
@input
import { Input } from '@angular/core';
- add
@Input
decorator to the property
@Input() isSelected: boolean;
<favorite [isSelected]="post.selected"></favorite>
Option 2:
- In component decorator add input property name
- The name should match the field name. if the name differs it will fail
- Not preferred
@Component({
inputs: ["isSeelcted"]
})