Oh, also, you need to declare angular.module('myApp', ['hellService']) if
you want access to helloDude in the myApp module, since you declared it in
the other module. I'd recommend a good read through of the angularJs
documentation.e On Sun Nov 30 2014 at 10:50:41 AM Eric Eslinger <[email protected]> wrote: > ['helloDude','$scope', function($rootScope,helloDude) { > > should be > > ['$rootScope', 'helloDude', function($rootScope, helloDude) { > > if you want to use that notation. Personally, I just use ng-annotate > instead. > > e > > On Sun Nov 30 2014 at 10:28:02 AM Sandeep Jsk <[email protected]> > wrote: > >> angular.module('myApp', []).controller('MainController', >> ['helloDude','$scope', function($rootScope,helloDude) { >> $rootScope.$on("$routeChangeStart", ['$scope',function() { >> var sss=helloDude.user(); >> console.log("In main controller and event is fired"+sss); >> alert("Event is fired"); >> }]); >> }]); >> >> >> angular.module('hellService',[]).service('helloDude', function() { >> // var user= function(){ >> return "hello"; >> alert("in service"); >> // }; >> }); >> >> ERROR:Error: [$injector:unpr] http://errors.angularjs.org/1. >> 2.26/$injector/unpr?p0=helloDudeProvider%20%3C-%20helloDude >> http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js >> Line 6 >> >> >> >> *OR* >> >> ERROR:Rd/this.$get</<()angular.min.js (line 68) >> a = >> Error: [$injector:unpr] http://errors.angularjs.org/1. >> 2.26/$injector/unpr?p0=helloDudeProvider%20%3C-%20helloDude >> >> ...p"+(c-1)+"="+encodeURIComponent("function"==typeof >> arguments[c]?arguments[c].toS... >> >> c = undefined >> Zd/this.$get</k.prototype.$apply() >> >> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
