【发布时间】:2013-10-03 01:02:56
【问题描述】:
如何从父作用域调用子作用域中定义的方法?
function ParentCntl() {
// I want to call the $scope.get here
}
function ChildCntl($scope) {
$scope.get = function() {
return "LOL";
}
}
【问题讨论】:
-
最好的办法,定义一个服务,将该服务注入两个控制器。或者使用 rootscope。