Saturday, August 18, 2018

javascript - Working with $scope.$emit and $scope.$on

How can I send my $scope object from one controller to another using .$emit and .$on methods?



function firstCtrl($scope) {
$scope.$emit('someEvent', [1,2,3]);
}


function secondCtrl($scope) {
$scope.$on('someEvent', function(mass) { console.log(mass); });
}


It doesn't work the way I think it should. How do $emit and $on work?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...