控制器angularjs内的访问功能

时间:2015-08-09 09:00:30

标签: angularjs

如何访问定义为$ scope函数但在控制器内定义的函数?如果我在代码中定义上面某处使用的函数,则无法访问它。有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

这是示例代码:

App.controller('TestController', ['$scope', function($scope) {

$scope.init = function () {
    $scope.funcVal = functionA();
},

$scope.init();

functionA = function() {
var a = 10;
},

}]);