Reputation: 39
While making use of SSG in angular application, can the components part of the routes set for SSG make API calls? When I try to implement it, I get an error that says NullInjectorError: No provider for InjectionToken REQUEST!
A work-around for this is to add @Optional()
on on the injection a request. But this won't have the desired effect since I would need to make API calls to get language translations for the content of the page (if the endpoint starts with /fr
).
If SSG is not applicable in this case, is there another way to pre-render the pages while making the initial API call for translations?
Upvotes: 0
Views: 464
Reputation: 119
you should navigate to app.config.ts and add the thing you want inside providers list. I had the same issue with HttpClient which has been solved by adding it in providers list inside the given direction.
Upvotes: 0