HTML
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
<body >
<div ng-app="myApp" >
<div ng-controller="parent">
{{o.name}}
<button ng-click="cli()">cli</button>
</div>
</div>
</body>
</html>
JS
var app = angular.module('myApp', []);
app.controller("parent",function($scope,$rootScope){
$scope.o ={ name:"gaoliang"};
$scope.age = 30
//监听对象变化第三个参数为true
$scope.nameChange = $scope.$watch('o',function(n,o,s){
console.log(n)
console.log(o)
console.log(s.age)
},true)
$scope.$watch('age',function(n,o,s){
console.log(n)
console.log(o)
console.log(s.age)
})
$scope.cli=function(){
$scope.o.name = "haha";
//$scope.age += 1;
}
})