我正在使用以下链接将 requirejs 与 angularjs 一起使用 https://github.com/StarterSquad/startersquad.github.com/tree/master/examples/angularjs-requirejs-2
如何使用js\services\version.js中定义的服务函数
我在服务中有以下代码。
services.factory('Phone', ['$resource',
function($resource){
console.log("factory");
}]);
我想在 Controller 中调用这个工厂函数。如何做到这一点?
最佳答案
只需在 Controller 中添加工厂即可。
app.controller('myController', function($scope, Phone){
});
关于javascript - AngularJS:从 Controller 调用工厂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23196941/