##举个例子来说明:##
现在有个对象:searchData
包含三个属性:fromCity、retCity、retDate
。
$scope.$watch('searchData',function() {
$scope.changeCallback({data: $scope.searchData});
},true);
searchData
包含多个属性,当其中任何一个属性发生变化时,$watch
都要监听到时,需要给$watch
配第三个参数,设为true
.