Angular JS update input field after change

前端 未结 5 1589
被撕碎了的回忆
被撕碎了的回忆 2021-01-30 20:26

I\'m trying to build a simple calculator in Angular in which I can override the total if I want. I have this part working but when I then go back to enter in a number in fields

5条回答
  •  猫巷女王i
    2021-01-30 21:15

    Create a directive and put a watch on it.

    app.directive("myApp", function(){
    link:function(scope){
    
        function:getTotal(){
        ..do your maths here
    
        }
        scope.$watch('one', getTotals());
        scope.$watch('two', getTotals());
       }
    

    })

提交回复
热议问题