Skip to content

Universal (isomorphic) javascript support for Angular2

License

Notifications You must be signed in to change notification settings

basarat/universal

 
 

Repository files navigation

Build Status Join the chat at https://gitter.im/angular/universal Issue Stats Issue Stats

<img src="https://cloud.githubusercontent.com/assets/1016365/10639063/138338bc-7806-11e5-8057-d34c75f3cafc.png" alt="Universal Angular 2" height="320"/>

Universal Angular 2

Universal (isomorphic) JavaScript support for Angular 2

Table of Contents

Modules

Manage your application lifecycle and serialize changes while on the server to be sent to the client

Documentation

Design Doc

Videos

Full Stack Angular 2 - AngularConnect, Oct 2015 Full Stack Angular 2

Angular 2 Server Rendering - Angular U, July 2105 Angular 2 Server Rendering

Control server-rendered page and transfer state before client-side web app loads to the client-side-app.

Best Practices

When building Universal components in Angular 2 there are a few things to keep in mind

  • Know the differece between attributes and properties in relation to the DOM
  • Don't manipulate the nativeElement directly. Use the Renderer
constructor(element: ElementRef, renderer: Renderer) {
  renderer.setElementStyle(element, 'fontSize', 'x-large');
}
  • Don't use any of the browser types provided in the global namespace such as navigator or document. Anything outside of Angular will not be detected when serializing your applucation into html
  • Keep your directives stateless as much as possible. For stateful directives you may need to provide an attribute that reflects the corresponding property with an initial string value such as url in img tag. For our native <img src""> element the src attribute is reflected as the src property of the element type HTMLImageElement.

What's in a name?

We believe the word universal is the correct when referring to a JavaScript Application that runs in more environments than the browser. (inspired by Universal JavaScript)

License

Apache-2.0

About

Universal (isomorphic) javascript support for Angular2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 82.8%
  • JavaScript 17.0%
  • Shell 0.2%