簡體   English   中英

angularjs:將兩個輸入求和並在第三個輸入中顯示

[英]angularjs: Sum two inputs and display in third input

我需要添加兩個輸入字段的值並顯示在第三個輸入字段中。 將輸入類型作為數字確實很簡單,但是不幸的是,這在IE中不起作用。 它在chrome中效果很好。 您能否在IE中幫助我,以便它同時支持這兩者。

<tr>
                                    <th>Business</th>
                                    <th><input type="number" class="col-sm-12" ng-model="input1"/></th>
                                    <th><input type="number" class="col-sm-12" ng-model="input2"/></th>
                                    <th style="background-color:beige"><input type="number" class="col-sm-12" value="{{input1+input2}}" readonly /></th>
                                    <th><input type="number" class="col-sm-12" ng-model="input3"/></th>
                                </tr>

此方法ng-value="input1+input2"將在IE11工作

 var app = angular.module('app', []); app.controller('AppController', function($scope){}) 
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div data-ng-app="app"> <table data-ng-controller="AppController"> <tr> <th>Business</th> <th><input type="number" class="col-sm-12" ng-model="input1"/></th> <th><input type="number" class="col-sm-12" ng-model="input2"/></th> <th style="background-color:beige"><input type="number" class="col-sm-12" ng-value="input1+input2" readonly /></th> <th><input type="number" class="col-sm-12" ng-model="input3"/></th> </tr> </table> </div> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM