我是新手使用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)