相关疑难解决方法(0)

如何从angularjs中的另一个控制器调用函数?

我需要在角度j的另一个控制器中调用函数.如果有可能,请提前帮助我

代码:

app.controller('One', ['$scope',
    function($scope) {
        $scope.parentmethod = function() {
            // task
        }
    }
]);
app.controller('two', ['$scope',
    function($scope) {
        $scope.childmethod = function() {
            // Here i want to call parentmethod of One controller
        }
    }
]);
Run Code Online (Sandbox Code Playgroud)

controller angularjs angularjs-scope

55
推荐指数
5
解决办法
15万
查看次数

标签 统计

angularjs ×1

angularjs-scope ×1

controller ×1