Nar*_*h k 8 function angularjs
我是新手使用angularjs并且我已经在控制器中声明了两个函数,现在我想将一个函数用于另一个函数我该怎么做才意味着如果我将函数名称称为另一个函数,它说Undefined.
这是代码:
'use strict';
angular.module('customer').controller('Controller', ['$scope', '$state', 'Sservice',
function($scope, $state, Sservice) {
var that = this;
(function getDetails() {
//IMPLEMENTATION
}());
this.function2 = function function2 (id){
//implementation
getDetails(); // says undefined
};
}
]);
Run Code Online (Sandbox Code Playgroud)
小智 12
.controller('SampleController',function($scope){
$scope.funcA = function(){
$scope.funcB();//scope level function
funcC(); //non scope level function``
}
$scope.funcB = function(){
}
var funcC = function(){
}
});
Run Code Online (Sandbox Code Playgroud)