ng-event

sample:


father:  

                 $scope.gotoTap = function(tapIndex)
 {

               //broadcast checkCalculate event to child control  

               $scope.$broadcast("checkCalculate", tapIndex);

 }

 $scope.$on('calcuRs', function(event,tapIndex) 
 {
  console.log("switch tap to index--> "+tapIndex);

             if(!$scope.isNull(tapIndex)&&(!isNaN(tapIndex)))

             {

              $state.go('app.customers.detail.quote.steps.quotePlan.plan'+tapIndex); 

             }else

             {

               console.log('tapIndex is null,can not switch tap~!');

             }   

 });


child:

$scope.$on('checkCalculate', function(event,tapIndex)
{
 toastrShow.syserror("hhahahhha");
 $scope.$emit('calcuRs',tapIndex);
});

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章