How to call api only sever and show data in page source in angular

Viewed 36

I am creating a blog module on my website in angular. I am using pre-render rendering. In my component, I am having a list of blogs. In this, I want to call API on the server side only. I want to show data in the page source. if I use this.getBlogPageInfo() then my API call on both server and browser.

if I use

if (isPlatformServer(this.platformId)) {
  this.getBlogPageInfo(); 
}

then my API calls on the server but in the browser, my API data is removed automatically.

if I call API only then my data is not visible in the page source. Please Help me. How can I improve my code?

0 Answers
Related