This is my demo using angularjs, for creating a service file, and adding service to a controller.
I have two problems with my demo:
In my situation this error appeared when I didn't declare function within an array argument.
The one with error:
taskAppControllers.controller('MainMenuCtrl', []);
The fixed one:
taskAppControllers.controller('MainMenuCtrl', [function(){ }]);