angularjs $watch $broadcast

来源:互联网 发布:mac os x10.10 dmg 编辑:程序博客网 时间:2024/05/13 19:55
$scope.$watch('singleDriver',function(newValue,oldValue){    if(newValue === oldValue){return;}    $scope.$broadcast('driverUpdate',newValue);},true);
$scope.$on('driverUpdate',function(d,data){    $scope.singleDriver = $rootScope.singleDriver;});

原创粉丝点击