This is my demo using angularjs, for creating a service file, and adding service to a controller.
I have two problems with my demo:
Obviously that previous posts are useful, but any of above are not helpful in my case. The reason was in wrong sequence of loading scripts. For example, in my case, controller editCtrl.js depends on (uses) ui-bootstrap-tpls.js, so it should be loaded first. This caused an error:
This is right, works:
So, to fix the error you need first declare all scripts without dependencies, and then scripts that depends on previously declared.