I created a simple service and a simple directive that use that service. Here is how it looks like:
angular.module("app",[]);
angular.module("app").factory('dummyService',dummyService);
angular.module("app").directive('dummyDirective', ['dummyService',dummyDirective]);
function dummyService(){
this.name = "hello";
}
function dummyDirective(dummyService) {
return {
link:function(scope){
console.log(dummyService.name);
}
}
}
However, when I run the code I get:
[$injector:undef] http://errors.angularjs.org/1.4.7/$injector/undef?p0=dummyService
Any suggestions?