Answer the question
In order to leave comments, you need to log in
How to animate code with AngularJS?
jsfiddle.net/tctkopre/2
<script>
var app = angular.module('foo', []);
app.controller('userCtrl', function ($scope) {
$scope.sum = $scope.range1 + $scope.range2;
});
</script>
<div ng-controller="userCtrl">
<input ng-model="range1" type="range" value="10" />
<input ng-model="range2" type="range" value="10" />
<h1>{{sum}}</h1>
</div>
Answer the question
In order to leave comments, you need to log in
var app = angular.module('foo', []);
app.controller('userCtrl', function ($scope) {
$scope.one = 10;
$scope.two = 10;
$scope.$watch('one', function(newValue, oldValue) {
summa();
});
$scope.$watch('two', function(newValue, oldValue) {
summa();
});
function summa(){
$scope.sum = parseInt($scope.one) + parseInt($scope.two);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question