javascript - AngularJS: call factory from controller -


I am using the following link to use requirejs with angularjs

How do I I can use the service function that is defined in the Js \ services \ version.js

I have the following code in the services.

  services.factory ('phone', ['$ resource', function ($ resource) {console.log ("factory");}]);   

I want to call this factory function in the controller. How to do this?

Firstly let your service "angular.module ();"

  application. Controller ('myController', ['phone' ',' $ radius', function (phone, $ radius) {// your code here}]);    

Comments

Popular posts from this blog

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -

jasper reports - How to center align barcode using jasperreports and barcode4j -

django - CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False -