1 // component.ts
2
3 @Component({
4 templateUrl: 'component.html',
5 selector: 'app-component',
6 })
7 export class Component {
8 name = 'Peter';
9
10 updateName() {
11 this.name = 'John';
12 }
13 }
14
1
2import { Component } from "@angular/core";
3@Component({
4 selector: 'app-example',
5 template: `
6 <div>
7 <input [value]='myText'></span>
8 </div>
9 `
10})
11export class AppComponent {
12 myText: string = "Hello World";
13}