var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.form = {
name: 'my name',
age: '25'
}
$scope.$watch('form', function(newVal, oldVal){
console.log(newVal);
},true);
$scope.foo= function(){
$scope.form.name = 'abc';
$scope.form.age = $scope.form.age++;
}
$scope.foo();
$scope.bar= function(){
$scope.form.name = 'xyz';
$scope.form.age = $scope.form.age++;
}
$scope.bar();
});var app = angular.module('myApp', [