Sharing this as a Qusstion-answer post.
What to do when you have to use $templateCache
in templateProvider
of a route in ui-router and have to utility the code? Injecting does not work, and angular cannot inject by reference.
Example :
...
templateProvider : function($templatecache) {
...
},
...
Use this instead :
...
templateProvider : ['$templateCache', function($templateCache) {
...
}],
...