AngularJs 모/자 Controller 전송 데이터

<div ng-controller="MyAccountCtrl">

   <div ng-controller="TransferCtrl">
           .............

   </div>

</div>

 
//          
//     
$scope.checkLoggedIn = function(type) {
          $scope.transferType = type;
          $scope.$emit('transfer.type', type);
}

//     
$scope.$on('transfer.type', function(event, data) {
          $scope.transferType = data;
        });
        $scope.checkLoggedIn = function() {
          var type = $scope.transferType;
}

 
//          
//     
$scope.transferType = '';
$scope.checkLoggedIn = function(type) {
          $scope.transferType = type;
          $scope.$broadcast('transfer.type', type);
}

//     
$scope.transferType = '';
$scope.$on('transfer.type', function(event, data) {
          $scope.transferType = data;
        });
        $scope.checkLoggedIn = function() {
          var type = $scope.transferType;
}

 
온라인 인스턴스: http://each.sinaapp.com/angular/apps/app-broadcast.html

좋은 웹페이지 즐겨찾기