Using factory within controller in angularjs -


I have simple modules with a controller and factory. I want to use the factory within my controller so I should add the name of the factory under my function () of the controller, so my controller no longer works (blank page, no error)

  var app = angular Module ('main', ['ngenet']) app.factory ('socket', function ($ scope) {...});  

My admin works if:

  app.controller ('demo' ctrl, function ($ radius, $ Http, $ filter, natural perm, $ timeout) {...});  

My Controller does not work If:

  app.controller ('Demo' Ctrl, function ($ radius, $ Http), $ filter, ngtimal perm, $ timeout, socket) {...});  

Can anyone help me on this?

You enter 't \ code> $ scope in any service in angular, because It does not have any sense in terms of services $ scope is for administrators only, so remove the $ scope dependency from your service: app.factory (' Socket ', function () {...});


Comments