I am using following link for using requirejs with angularjs .github/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?
I am using following link for using requirejs with angularjs https://github./StarterSquad/startersquad.github./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?
Share Improve this question asked Apr 21, 2014 at 11:55 PriyaPriya 1,4814 gold badges32 silver badges56 bronze badges2 Answers
Reset to default 4Just add the factory in your controller.
app.controller('myController', function($scope, Phone){
});
First you have to register your service in " angular.module(); "
app.controller('myController',['Phone','$scope',function(Phone,$scope){
//your code here
}]);