-
Notifications
You must be signed in to change notification settings - Fork 482
Prerender does not work with templateUrl or styleUrls #294
Comments
@manekinekko has this issue been resolved? |
it shouldn't be resolved. the issues is that on the server the url needs to be a full url |
I was getting crazy before I read this issue. I'm subscribing waiting for news. |
Hah, exactly. Webpack seems to be the solution in the meantime.
|
@gdi2290 i tried using full url as |
Try using this instead @Bhushan001: |
@helenitvn @gdi2290 I tried |
@Bhushan001: Could you show me your project structure? It works in my case. |
@helenitvn in case of normal angular2 app it works.but I am trying to use it with universal-starter |
I also use universal-starter as my seed, too. In your case you need to use |
@helenitvn its still not working but this worked for me. |
For me
|
@gdi2290 @jeffwhelpley @jeremythuff @helenitvn previously |
@gdi2290 @jeffwhelpley any inputs? |
@gdi2290 my head is swiss cheese at this point, but didn't we have a change to BASE_URL recently that may have affected this? |
I posted a workaround for this issue in #346 which is published with >=0.86.0. I'm not sure if it will work in all cases, but it worked for my project. You can set a custom URL resolver to change your template/style urls to be My resolver looks like this: export class NodeUrlResolver extends UrlResolver {
resolve(baseUrl: string, url: string): string {
return `file://${path.resolve(path.join(baseUrl, url))}`;
}
} and I provide it during prerender with: provide(UrlResolver, {useValue: new NodeUrlResolver}), |
@jeffwhelpley @gdi2290 has any fix released yet? |
@Bhushan001 can you update to |
@gdi2290 i installed the |
@Bhushan001 I created a PR for your repo https://github.com/Bhushan001/universal-starter-master/pull/1 |
@gdi2290 any ideas on when this feature will be available ? |
I need to update zone.js for it to track |
It works in my project with the external html being rendered server-side. It works always fine for directives outside the router-outletm, but inside the router-outlet it works only on the first serve. After a reload, even a hard reload or a load in another browser the prerendered-html of the router-outlet is missing. The example lies here. |
@gdi2290 any success yet? |
@gdi2290 @jeffwhelpley we are working on a project in which this feature is required.I was wondering If u could provide any inputs on when this feature will be available? |
Sorry for the delay in response @Bhushan001. Last week was crazy with ng-conf and we are just starting to get back into things. So, the status here is that we know what needs to change (modifications to the zones patch) and I have it right near the top of our overall priority list. @gdi2290 can you provide an update once you get the fix in for this? |
Hi @gdi2290 , did you get a chance to look into this? |
@vinodbhargava Patrick is working on this right now. This is one of out two top priorities right now as it is roadblocking several other things. You can expect to hear an update on this within the next week. |
This worked for me: My component that contains my app ('my-app') in the index page looks like this: Every other component within that I navigate to looks like this:
|
@gdi2290 @jeffwhelpley try "app/" not "/app/" - look at my comment above. |
for styleUrls doesn't work though so I need to look into that |
I've been following this thread closely, and was just checking in to see if there's an update. Haven't gotten any of the proposed work-arounds to work as of yet, and would love to know more about the proposed patches coming down the pipeline. Thanks in advance. |
for webpack use angular2-template-loader. it's setup in the universal-starter |
Thanks for the response @gdi2290. I'm realizing now that I might be looking at the problem wrong if the resolution is as simple as that. I started from the universal-starter and thus have angular2-template-loader in place, but didn't want to be stuck leveraging the router-deprecated, so I updated to the latest and made the relevant modifications to the route configuration. I thought I had read elsewhere that the latest version of angular-universal was supportive of the new router, but it's possible that my issues are related to those updates instead of explicitly to the templateUrl locations. I may have leapt to conclusions since I was experiencing errors server-side but not client-side. |
track #432 for runtime styleUrls. for runtime templateUrl provide __filename for moduleId |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
@jongood01 has reported this issue in the universal-starter
see issue here: angular/universal-starter#43
The text was updated successfully, but these errors were encountered: