property binding angular documentation code example
Example 1: angular property binding
@Component({
templateUrl: 'component.html',
selector: 'app-component',
})
export class Component {
name = 'Peter';
updateName() {
this.name = 'John';
}
}
Example 2: property binding angular documentation
@Component({
templateUrl: 'component.html',
selector: 'app-component',
})
export class Component {
name = 'Peter';
updateName() {
this.name = 'John';
}
}
<p>My name is {{name}}</p>
<button (click)="updateName()">Update button</button>