angular binding
snippet in html

angular binding

user8385

<input [disabled]="condition ? true : false">
<input [attr.disabled]="condition ? 'disabled' : null">

Bidirectionnal model binding

user7331

      
        content_copy
      
      <app-sizer [(size)]="fontSizePx"></app-sizer>
    

angular property binding

user9289

    // component.ts

    @Component({
      templateUrl: 'component.html',
      selector: 'app-component',
    })
    export class Component {
      name = 'Peter';

      updateName() {
        this.name = 'John';
      }
    }

property binding angular documentation

user7733

    // component.ts

    @Component({
      templateUrl: 'component.html',
      selector: 'app-component',
    })
    export class Component {
      name = 'Peter';

      updateName() {
        this.name = 'John';
      }
    }
        // component.html

    <p>My name is {{name}}</p>
    <button (click)="updateName()">Update button</button>

angular property binding

user3551


import { Component } from "@angular/core";
@Component({
   selector: 'app-example',
  template: `
              <div>
              <input [value]='myText'></span>       
              </div>
              `
})
export class AppComponent {
  myText: string = "Hello World";
}

angular property binding

user256

    // component.html

    <p>My name is {{name}}</p>
    <button (click)="updateName()">Update button</button>