Open mogudy opened 8 years ago
replay:
sample code:
controller.js
$rootScope.$on('event:notify-success', function(event,data) { notifySuccess({message: JSON.stringify(data), delay: 1000}); //$rootScope.$$listeners['event:notify-success'] = []; }); function notifySuccess(data){ //Notification.success({message: data, delay: 1000}) alert(JSON.stringify(data)); } $scope.hoho = function (){ $rootScope.$emit('event:notify-success', '22222222'); }; $scope.hahaha = function (){ Notification.success({message: 'test', delay: 1000}) };
index.html
<body ng-controller="testCtrl"> <h1 ng-click="hahaha()">hahaha</h1> <h1 ng-click="hoho()">hoho</h1> </body>
replay:
sample code:
controller.js
index.html