Typescript 离子输入问题。尝试绑定prodbum.totalamt时未定义的值。可能是什么问题?
离子输入问题。尝试绑定prodbum.totalamt时未定义的值。有什么问题吗Typescript 离子输入问题。尝试绑定prodbum.totalamt时未定义的值。可能是什么问题?,typescript,ionic2,Typescript,Ionic2,离子输入问题。尝试绑定prodbum.totalamt时未定义的值。有什么问题吗 <ion-item> <ion-label floating>Secondname</ion-label> <ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input> </i
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [value]="prodbum.username * prodbum.secondname" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>
用户名
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [value]="prodbum.username * prodbum.secondname" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>
第二名
总计:{{prodbum.username*prodbum.secondname}
您可以为此使用更改事件,并在组件端设置您的prodbum.totalamt
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [value]="prodbum.username * prodbum.secondname" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>
例如:
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [value]="prodbum.username * prodbum.secondname" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" (change)="findProd()" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>
您可以从第一个输入的
change
事件调用相同的函数。为什么同时使用value
和ngModel
?@Suraj我正在将其值从第一个和第二个离子输入传递到第三个离子输入。第三个输入的值是第一个和第二个输入的乘积。现在我想通过[(ngModel)]访问第三个离子输入的输入。我该怎么办?谢谢
<ion-item>
<ion-label floating>Secondname</ion-label>
<ion-input type="number" name="secondname" [(ngModel)]="prodbum.secondname" required></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Total: {{prodbum.username * prodbum.secondname}}</ion-label>
<ion-input type="number" [value]="prodbum.username * prodbum.secondname" [(ngModel)]= "prodbum.totalamt" readonly="true"></ion-input>
</ion-item>
<ion-item>