Questions tagged angular-universal

Explore the latest questions and answers asked by our top developers.

Automatic crash on Angular universal project on server

In the Angular universal project. After a while on the server, the site automatically crashes and the server needs to be restarted. These errors are in the log. This has happened twice in the last month. There are too many "Converting circular structure to JSON" errors in the log file. (node:24572) [DEP0005] DeprecationWarning: Buffer() is […]

How do I debug angular server side code in vscode or webstorm

Angular server side code is throwing errors and its hard to figure out what is causing the error. I boiled it down to two routes that were causing the error, but before I strip the routes to the barebones and recheck, I just wanted to see if I can put some breakpoints on main.js to […]

Angular Universal on AWS Lambda error 403

I am new to the serverless framework and AWS lambda functions. I have set up SSR with the AWS lambda function and tested locally (using serverless-offline) it works as expected. However after deploying to AWS, only the index.html and basic styles are rendered and other routes return a 403 forbidden error. Below is my configuration. […]

When exactly is Angular Universal sent to the client?

I just stated to learn Angular Universal and can’t understand one thing. For example I have a component where I get tasks and display them … ngOnInit() { this.tasksService.getAll().subscribe(tasks => this.tasks = tasks); } …. When is this component will be sent to the client? Does the server send the main template and afterward the […]

How to deploy my angular-app in heroku with angular universal?

To upload an angular project in heroku I run the command ng run build –prod and the files i copy to the public folder in my backend. Then i make the commit to Heroku. Now i want to do the same with angular universal but it creates two folders, browser folder and server folder. My […]

Angular Universal TransferState.toJson return {} but in html exist

Dont work TransferState when use angular routing. The content its in html file source but return {} in angular component. The interceptors works fine when reload the page but return {} when came from a route Ex: (routerLink=¨/detail¨) @NgModule({ imports: [ AppModule, ServerModule, ServerTransferStateModule, ], providers: [ // Add universal-only providers here { provide: HTTP_INTERCEPTORS, […]

Angular does not work in IE and smart tv browsers

My website is built with Angular 12 and SSR. but It doesn’t work on IE or Samsung TV browsers. i added these lines to my polyfills.ts. import "core-js/es/symbol"; import "core-js/es/object"; import "core-js/es/function"; import "core-js/es/parse-int"; import "core-js/es/parse-float"; import "core-js/es/number"; import "core-js/es/math"; import "core-js/es/string"; import "core-js/es/date"; import "core-js/es/array"; import "core-js/es/regexp"; import "core-js/es/map"; import "core-js/es/weak-map"; import "core-js/es/set"; import […]

Angular Universal loads login page for brief second

I recently enabled Angular Universal in my project. Everything works as expected, except for one strange issue. Whenever I refresh page or click a link in email that navigates to webpage, I see Login page for brief second then actual page loads. Sample project created and uploaded to Github. Remember the delay may not as […]

Angular Universal Build on Plesk – View page source not render

I try to deploy an Angular app on Plesk. I add angular universal to my application, and run build:ssr. On the Server, I install node js 12 also install pm2 and deploy the build folder [browser and server] folders and make the path to dist/MyApp/browser also run /opt/plesk/node/12/bin/pm2 start dist/MyApp/server/main.js After all of this, view […]

By Sameh Mohamed Omr
Published
Categorized as angular, angular-universal, plesk Tagged , ,

Redirect user agent-based in Angular 12 and SSR

I implemented my VOD website with Angular 12 and SSR. I want to redirect smart TV users to another URL based on their user agent. In my app component, I use this code to detect user agents. <pre><code>checkUserAgent() { let userAgent = this.deviceService.getDeviceInfo()[&quot;userAgent&quot;]; userAgent = userAgent.toLowerCase().trim(); if ( userAgent.includes(&quot;tizen&quot;) || userAgent.includes(&quot;webos&quot;) || userAgent.includes(&quot;androidtv&quot;) || userAgent.includes(&quot;tv&quot;) […]

1 32

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq