angular $watch 一个变量的变化

$scope.$watch('custArea', function(newValue, oldValue) {
            angular.forEach(newValue, function(item, key) {
                if($scope.custArea.indexOf("000000") > -1){
                    // $scope.toastWarn("已选择中国大陆所有省市,其他值不可选");
                    $scope.custArea =["000000"];
                }else{}
            });
        }, true);

 

posted @ 2017-08-01 16:30  Cynthia娆墨旧染  阅读(301)  评论(0编辑  收藏  举报