-
Notifications
You must be signed in to change notification settings - Fork 248
TemplateCacheGenerator rewrites URLs #1670
Comments
Try rewriting your urls to relative - That way your component can be turned into a library and consumed by many different apps. Without having to change templateUrl. Take a look at our tests and feel free to contribute a test case that better matches your setup. |
Might have something to do with #1707 |
With 1.1.1 release we migrated all our |
I've updated my app to angular 1.1.2 version. I use relative path The problem is that app.html is in ``http://localhost:63342/my_app/web/packages/my_app/component/` folder. I'm guessing it would work if WebStore served files from |
@avstudios I had the same issue is because they changed the default package root from 'packages/' to '/packages/' which broke our app as we don't run it in the root but in a sub folder. But can be fixed by adding this bining in your app module.
|
@jrote1 Thanks a lot for the solution. My app started working again. |
No problem, I raised an issue saying this is a breaking change and should be changed back but there has been no reply as of yet. #1707 |
@jrote1 Thank you. I was facing same issue and this fixed it. |
@ashokdudhade no problem happy to help |
@jrote1 I'm testing my app on dev server now and I found an issue in IE10+ browsers. They can't load images because the src attribute is not transformed to the right path. For instance i have: |
@avstudios I have not come across this issue but if you can send me a link the some code that replicates I don't mind looking into it. |
I've cloned Chapter_06 example from
If you open http://dev.avstudios.com/dart_angular_example/ link in chrome then you will see the pictures. |
@avstudios thanks for that i'll look into it at somepoint today see if I can resolve the issue. |
@jrote1 I've just noticed the same problem also in Chrome if I use dynamic name: |
@avstudios sorry for late reply have been really busy, I had a look and it seems like a bug as far as I can see I might be able to fix in the future if I have time but cannot guarantee when. But to fix your issue just use full urls relative to your main html file. Your lib folder would be: pakcages// |
@jrote1 Thanks for checking this. I'm displaying the images using background-image property in css at the moment. It's not perfect solution but works. Soon I need to run my app in Atom Shell and will check everything again. It would be great if you will find a time to fix it. |
Currently the default in angular.dart is to try to rewrite URLs in components relative to the type location. @avstudios it appears you don't want this functionality. In this case change the config to be: That will leave your URLs untouched. Note: The reason the default is to try to rewrite URLs based on the type location is it makes the component reusable. Otherwise you have to know the context of where the component is going to be used in the web app. Which breaks re-usability. Imagine one developer created a component to live at /index.html and another wants to use the component at /app/index.html all of the sudden the resource URIs need to be different. |
I use
templateUrl
s written in this form:After generating template cache with
TemplateCacheTransformer
, URL turns into/packages/myapp/components/footer.html
(notice leading slash), hence templates can't be matched against the cached keys and loaded from the server as individual HTTP requests.The text was updated successfully, but these errors were encountered: