Reputation: 1481
I am using following link for using requirejs with angularjs https://github.com/StarterSquad/startersquad.github.com/tree/master/examples/angularjs-requirejs-2
how can i use service function which is defined in js\services\version.js
i have following code in services.
services.factory('Phone', ['$resource',
function($resource){
console.log("factory");
}]);
i want to call this factory function in controller. how to do that?
Upvotes: 0
Views: 5152
Reputation: 1260
First you have to register your service in " angular.module(); "
app.controller('myController',['Phone','$scope',function(Phone,$scope){
//your code here
}]);
Upvotes: 1
Reputation: 3783
Just add the factory in your controller.
app.controller('myController', function($scope, Phone){
});
Upvotes: 4