Home » Angularjs » Angular 2 Universal – Server-side Rendering

Angular 2 Universal – Server-side Rendering

Posted by: admin November 30, 2017 Leave a comment

Questions:

I was reading about Angular 2 Server side rendering with node.

But I cannot find an example or explain how should I do that.
I need to render some pages with angular from server, any advice?

Answers:

This is the example the creators of angular-universal used in their talk, its a working repo -> https://github.com/angular/universal-starter/tree/angular-connect

And this is the talk – Full Stack Angular 2

Questions:
Answers:

Well, look at this starter kit
https://github.com/alexpods/angular2-universal-starter. It has server side rendering, web workers support (entire angular2 application is running in a web worker) , lazy loading (using webpack’s code splitting) and many other things. I hope it will help you.

Disclosure: I’m its author.

Questions:
Answers:

Take a look here: https://universal.angular.io/

Looks like ‘some’ of the official documentation/site is now up. API docs are in the code but for quick reference see these links:

https://universal.angular.io/api/universal/index.html#typedoc-main-index
https://universal.angular.io/api/preboot/globals.html

Nice third party overview and setup doc: https://mickaelkerjeanblog.wordpress.com/2016/05/02/angular-universal/

Questions:
Answers:

There’s another example repo at https://github.com/ng-seed/universal showcasing both Universal and lean Angular on a single project.

This application uses platform-server delivered with Angular 4.0.0, and it could be a good starter/seed project until Angular provides some documentation about the use of platform-server.

Furthermore, it covers most of the features of angular2-webpack-starter by AngularClass such as async/lazy routes, SCSS compilation (both inline and external), dev/prod modes, AoT compilation via @ngtools/webpack, tests, TsLint/Codelyzer, @types and maybe more.

Disclosure: I’m the author too 🙂