PROBLEM DESCRIPTION
Angular Universal does not display the dynamic data of my "Posts" component when I click on "View Page Source". Although, what is a little weird, is that I will see it sometimes... I think it's a timing/delay thing. If I load a page and let it sit for 10 mins or so, and then click "View Page Source" again, then I will see the missing dynamic content that was not there before. Doesn't happen consistently every time, though!
PROBLEM EXAMPLE
See the comment tags below (i.e.: <!---->
)? That's where the data/content should be!
<div _ngcontent-sc413="" class="post"><!----></div><!----><!----></div></app-post-detail-page><!----></app-root>
ANGULAR VERSIONS
- "@angular/cdk": "^14.2.3"
- "@nguniversal/express-engine": "^14.2.0"
WHAT I'VE TRIED
I set up Angular Universal by following two excellent tutorials:
- This YouTube tutorial from Codeible;
- The "Angular Universal In Depth (Angular 15)" course from Udemy;
- In terms of trying to fix my problem, I've done a bunch of desperate Googling. Nothing I've tried has worked (although I haven't tried everything yet). It seems the likeliest culprits might be:
- I might need to use Angular Resolve (See this stackoverflow)
- I might have to look into TransferHttpCacheModule (See this stackoverflow)
- I might have to make sure I set up TransferState (See this YouTube video)
- Sidenote: Not sure if "TransferState" is the answer...we do have "BrowserTransferStateModule" in place ... although VSCode is now yelling at me and telling me this is deprecated; visiting Angular itself explains that we can now just use TransferState without injecting the BrowserTransferStateModule.
So, I haven't really tried anything, so much as researched a bunch of things, without knowing which is the correct path to follow.
What's even more confounding is that some posts/articles state that Angular Universal does not display dynamic data automatically, while others say that it does.