-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check isPlatformBrowser value "false" in template during server-side render #552
Comments
The Browser console is returning |
Very strange. I print the value of isBrowser in the console and its's true:
result is: 'Is browser: true' But this component have attached view (recent-projects-module.component.html) and in the view this code return false:
Result rendered by the component:
I tried to investigate and issue appears when we have follow component into the view: |
The Node server rendered version is going to come out false, but once client-side rendering takes over it'll flip over to true. You're trying to not use owl-carousel for the Node version I'm guessing. Try wrapping that directive/component with ng-container, that's typically the best way of conditionally doing it. <ng-container *ngIf="isBrowser">
... stuff you don't want to be SSR'd
</ng-container> Hope that helps! |
It's the same. my stuff (owl-carousel) components it's not visible into the browser's DOM like before because the value of the variable stay in false state. |
Hi,
I have component which have scripts which are browser specific and we have to run them when open the page in browser. But after last changes to angular 5 if I hit the route to this view directly, isBrowser is false and the script is not executed. If I hit another route and switch to the first will execute it and looks ok (isBrowser is true). I'm using follow code to get isBrowser:
What is wrong here. Is it normal to return that isBrowser=false when hit firstly the route?
Thank you
Gettaxsolutions Ltd
The text was updated successfully, but these errors were encountered: