1.

What is property binding? Explain with a syntax.

Answer»

In Angular, Property binding is a technique that lets you set the property of a particular view element. It involves updating VALUES within a property in the COMPONENT and then binding it to an element INSIDE the view template. Property binding in Angular uses the [ ] syntax for data binding. An example of this is SETTING the disabled state of a button.

Example

// component.html
&LT;button [disabled]="buttonDisabled"></button>
HTML
// component.ts
@Component({
   templateUrl: 'component.html',
   selector: 'app-component',
})
export class Component {
   buttonDisabled = true;
}



Discussion

No Comment Found