在双向数据绑定中使用ngModel
<input [(ngModel)]="this.name" >
实际上是
<input [value]="this.name" (input)="this.name=$event.target.value>
所以在内部将事件ngModel映射到(input)<input>this.name
我在哪里可以找到有关 ngModel 为其他元素(例如<p>等)生成的事件的信息?
我想增加点击<p>时的字体<p>。我可以不做,ngModel但不能做ngModel
没有ngModel
<p [style.font-size.px]="this.fontsize" (click)="handleParaClick()">Hello {{this.paratext}} {{this.fontsize}} </p>
handleParaClick():void{
this.fontsize+=10;
}
但我做不到
<p [(style.font-size.px)]="this.fontsize" >Hello {{this.paratext}} {{this.fontsize}} </p>
我猜对于<p>,要么ngModel不做任何事情,要么不生成(click)事件