如何使用角度计算基于公式的结果

时间:2017-03-03 10:08:23

标签: html angularjs

我有3个输入值A,B,C。如果我在变量事件计算结果中给出公式(like A+B+C or A+100,A*B,A+B+1500)中的任何表达式 怎么做

A:<input type="text" ng-model="v.A" />
B:<input type="text" ng-model="v.B" />
B:<input type="text" ng-model="v.C" />
<br />
Formula:<input type="text" ng-model="v.Formula" ng-blur="CalculateFormula(v)" />
{{result}}

Angular script

//on change of formula
 $scope.CalculateFormula = function (v) {

      //
    }

你能告诉我该怎么办

1 个答案:

答案 0 :(得分:0)

在元素上使用ng-change指令你想要找到结果。 例如。 ng-change = v.calcresult()