b) Property Binding (.ts --> .html)
To set the property of an element in view to a property defined in the component's class
- Property Vs Attribute:
- Attributes and properties are not the same
- Attributes are defined by HTML
- Properties are defined by DOM
- Attribute values can not be change once they are initialized.
- Property values can change
public name="Sai Krishna"
public isDisabled : boolean = false
<input type="text" value={{name}} id={{name}}>
<input type="text" [value]="name" [id]="name">
<input type="text" [value]="name" [id]="name" disabled>
<input type="text" [value]="name" [id]="name" disabled={{isDisabled}}>
<input type="text" [value]="name" [id]="name" [disabled]="isDisabled">
No comments:
Post a Comment