ionic 2 binding collision with ngModel:
i want the name of the iion-input to bing to an array, and the input text also bind to other att.
how should i do it?
<ion-input type="text" [name]="this.formAtt[0]" [(ngModel)]="this.formAtt[0]">{{this.temp }}</ion-input>
and if i do this, the name won't bind:
<ion-input type="text" [name]="this.formAtt[0]" [(ngModel)]="this.temp"></ion-input>
thanks
this
in templates isnât needed, but I canât reproduce your problem:
fruits = ['apple', 'banana', 'cherry'];
fruit = 'banana';
<ion-input [name]="fruits[0]" [(ngModel)]="fruit"></ion-input>
âŚresults in:
<input class="text-input text-input-md" ng-reflect-klass="text-input" ng-reflect-ng-class="text-input-md" type="text" autocomplete="off" autocorrect="off" placeholder="" ng-reflect-name="apple" ng-reflect-model="banana">
âŚwhich looks like what one would expect.
1 Like
hi,
it crashes with exception:
the code:
temp=âabc123â;
<ion-input type="text" [name]="temp" [(ngModel)]="this.dataSegmentInputs[this.formAtt[2]]"></ion-input>

i changed
temp=âabc123â;
to
temp=âabc123â;
if you have any idea why single quote workd and double dontâŚplease tell me.
anyhow, thanks for the solution!