Posts

Showing posts from June, 2019

Server-side Rendering (SSR): An intro to Angular Universal

Enable SSR in Angular 8.0 ng add @nguniversal / express - engine -- clientProject angular . io - example where angular.io-example = your project name. Build SSR angular project using this command npm run build : ssr && npm run serve : ssr Deploy or upload Angular SSR 8.0 project into server  npm run build:ssr Move the  dist  over to your server install  PM2 npm install pm2 -g On your server, use PM2 to run the server bundled app pm2 start dist/server.js If you're using Nginx, or other web servers, make sure to redirect requests to the port that the app started with PM2 is listening on. To stop PM2 use following command. pm2 stop  dist/server.js

Load Document.Ready function on Routing navigation in angular 4-5-6-7-8

write your all document.ready code in one single jquery function and call that function on document.ready. use this function on typescript. import { Component , OnInit } from '@angular/core' ; declare function main_init (): any ; declare function common_init (): any ; @ Component ({ selector: 'app-home' , templateUrl: './home.component.html' , styleUrls: [ './home.component.css' ] }) export class HomeComponent implements OnInit { constructor () { } ngOnInit () { main_init (); common_init (); } }