angularjs - How do I $templateCache.get the content for app.config from a templates.js file? -
i think it's quite put in title already, i'm trying do, have template content $templatecache.get(); i've tried dependency inject $templatecache different parts of app.config
... ... .config(['$routeprovider', '$templatecache', function($routeprovider, $templatecache) { $routeprovider. when('/', { template : function ($templatecache) {return $templatecache.get('main.html');} }).
this results in $templatecache not function.
my app.js own module , templates.js linked in index file after app.js file. template.js file created grunt task , puts content stuff repected templates.
i saw question here had templatecache iterated , content there put templatecache in app.run part quess question whether can somehow use template.js uses app.run put() $templatecache, or have refactor grunt task build json object? plnkr and/or resources help. sorry being vague.
why aren't using directly templatecache id of tempalte (it's filepath/filename if it's html2js-ified) ? angular automatically load templatecache if matching templatecache key exists :
$routeprovider. when('/', { templateurl : 'main.html' })
Comments
Post a Comment