How can I send my $scope
object from one controller to another using .$emit
and .$on
methods?
(如何使用.$emit
和.$on
方法将$scope
对象从一个控制器发送到另一个控制器?)
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?($emit
和$on
work如何运作?)
ask by Paul Kononenko translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…