In two-way data binding using ngModel
<input [(ngModel)]="this.name" >
is actually
<input [value]="this.name" (input)="this.name=$event.target.value>
So ngModel
internally maps (input)
event of <input>
to this.name
Where can I find information about the events ngModel generates for other elements like <p>
etc.?
I want to increase the font of <p>
when <p>
is clicked. I could do it without ngModel
but couldn't do it with ngModel
without ngModel
<p [style.font-size.px]="this.fontsize" (click)="handleParaClick()">Hello {{this.paratext}} {{this.fontsize}} </p>
handleParaClick():void{
this.fontsize+=10;
}
But I couldn't do
<p [(style.font-size.px)]="this.fontsize" >Hello {{this.paratext}} {{this.fontsize}} </p>
I am guessing that for <p>
, either ngModel
doesnt do anything or does not generate (click)
event
` doesn't make sense as `
`'s data would not change (from UI to affect the model).
– Manu Chadha Jun 26 '17 at 08:55