mgcrea / angular-strap

AngularJS 1.2+ native directives for Bootstrap 3.
mgcrea.github.io/angular-strap
MIT License
5.73k stars 1.38k forks source link

Template not found in cache when using an interceptor to modify outgoing request urls #2267

Closed TiboQc closed 5 years ago

TiboQc commented 6 years ago

Hi,

Having a template issue when trying to migrate from 2.2.1 to 2.3.6 (better late than never!).

We have an interceptor that adds a timestamp at the end of each .tpl.html request to be sent, to disable caching. The issue is that the new fetchTemplate function will always make a $http.get call (using cache), which will pass through the interceptor BEFORE reading the cache.

Our interceptor modifying the URL, the $templateCache does not contain the exact URL anymore and we end up with a 404, as it then tries to read it from the server which doesn't have it as it's only defined in the angular-strap templates.

Temporary workaround is the same as @hypercuba here (revert to the old fetchTemplate method).

Here's a plnkr that reproduces the issue, uncomment the <script> tag in <head> to use the overridden fetchTemplate function: https://plnkr.co/edit/vz7z9CE0zcwT61oFx90E?p=preview

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.