angular 双向绑定

<input type="text" [(ngModel)]="name">
{{name}}
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-bind',
templateUrl: './bind.component.html',
styleUrls: ['./bind.component.css']
})
export class BindComponent implements OnInit { private name; constructor() { } ngOnInit() {
this.name = 'cys';
} }
上一篇:Vue && Angular 双向绑定检测不到对象属性的添加和删除


下一篇:angular双向绑定与单向绑定的写法区别