Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 离子输入问题。尝试绑定prodbum.totalamt时未定义的值。可能是什么问题?_Typescript_Ionic2 - Fatal编程技术网

Typescript 离子输入问题。尝试绑定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

离子输入问题。尝试绑定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>

第二名
总计:{{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>