It's worthwhile to use the $templateCache. I use a gulp tool for it,
https://www.npmjs.org/package/gulp-angular-templatecache/

In particular, with a templatecache, you can change the 500 XHR requests
needed to load route templates into a single request, which will improve
page-load times. If your users only see a small percentage of the templates
when they load a page, that improvement may be a wash, as the bigger
templatecache file ends up taking longer to move over the wire than the
three templates a real user needs, but that's typically not the case in
angular projects I've seen.

Secondly, with an automated system like that in place, you can also use
cache-busting techniques to make sure that the user is getting updated
versions of templates when you change them. I found that we were publishing
new template HTML files to the production system and setting nginx's cache
data correctly and users were _still_ seeing old versions of some routes.
By putting all the templates into one javascript templatecache file, I used
another gulp tool (gulp-rev) to rename the resultant file. So instead of
templates.js, it's templates-aba239.js, or whatever. The extra string is
based on the md5 hash of the file contents, so when the contents change,
the filename changes. Then a final gulp tool (gulp-inject) modifies the
index.html file to make certain that the correct template.js filename
actually gets injected to index.html.

eric

On Wed Nov 05 2014 at 7:11:17 AM Anton Kuznetsov <[email protected]> wrote:

> I didn't use $templateCache ever.
>
>
> On Wednesday, November 5, 2014 5:57:16 PM UTC+3, Srini Kusunam wrote:
>>
>> Anton,
>>
>> Still not clear. We have similar setup where all UI (JS, html, css,
>> images etc) are served from Akamai CDN server and backend is on different
>> domain. We do not even own some of them.
>>
>> On UI side we have Grunt build which concatenates all JS files and also
>> adds all HTML files to final JS file using $templateCache. I always refer
>> to my template as relative path like this: https://github.com/
>> libertyleap/angular-grunt-seed/blob/master/src/js/app-routes.js and it
>> should load templates automatically from $templateCache.
>>
>> Do you know about $templateCache? Let me know if you are not clear on my
>> question \ suggestion?
>>
>> Thanks,
>> Srini
>>
>>
>> On Wednesday, November 5, 2014 8:12:52 PM UTC+5:30, Anton Kuznetsov wrote:
>>>
>>> We (front-end team) don't want to build backend in Visual Studio. We
>>> want to work on different OS. Backend will be in a cloud, we will rewrite
>>> only hostname for static resources in "hosts" for development on local
>>> machine.
>>>
>>> On Wednesday, November 5, 2014 5:02:58 PM UTC+3, Srini Kusunam wrote:
>>>>
>>>> Why do you move all your HTML templates to another static server? Is
>>>> there any reason why you are not packaging these templates with one final
>>>> concatenated JS using $templateCache?
>>>>
>>>>
>>>> On Wednesday, November 5, 2014 5:15:35 PM UTC+5:30, Антон Кузнецов
>>>> wrote:
>>>>>
>>>>> Hi!
>>>>>
>>>>> I have a problem on my current project with *templateUrl*s for
>>>>> Controllers and Directives.
>>>>> At the moment I have one server, one domain name, for example: 
>>>>> *servername.com
>>>>> <http://servername.com>*.
>>>>> Our static files migrates to another domain like: 
>>>>> *static.anotherdomain.com
>>>>> <http://static.anotherdomain.com>*
>>>>>
>>>>> How can I bind *templateUrl* prefix for all my Angular templates in
>>>>> one place instead replace all urls? Is it possible?
>>>>>
>>>>  --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to