Vote count:
0
I think it's quite well put in the title already, but what I'm trying to do, is have a template content from $templateCache.get(); I've tried to Dependency Inject $templateCache to different parts of the app.config
...
...
.config(['$routeProvider', '$templateCache', function($routeProvider, $templateCache) {
$routeProvider.
when('/', {
template : function ($templateCache) {return $templateCache.get('main.html');}
}).
This results in $templateCache is not a function.
My app.js is its own module and templates.js is linked in the index file after the app.js file. Template.js file is created by a Grunt task and it puts the content stuff their repected templates.
I saw some question here that had templateCache iterated and the content from there put into templateCache in the app.run part so I quess my question is whether I can somehow use my template.js that uses app.run to put() into the $templateCache, or do I have to refactor my Grunt task to build it into a json object? Any plnkr and/or resources would help. Sorry for being vague.
How do I $templateCache.get the content for app.config from a templates.js file?
Aucun commentaire:
Enregistrer un commentaire