fix(platform-server): render styles in app component instead of <head>

This ensures when the tree is serialized to the client and the app is later bootstrapped,
the <style> tags created during server-side rendering are destroyed.
This commit is contained in:
Alex Rickabaugh
2017-02-14 11:34:05 -08:00
committed by Igor Minar
parent 17486fd696
commit 30380d010b
4 changed files with 84 additions and 5 deletions

View File

@ -47,6 +47,7 @@ export class ServerRenderer implements Renderer {
if (componentProto.encapsulation === ViewEncapsulation.Native) {
throw new Error('Native encapsulation is not supported on the server!');
}
this._rootRenderer.sharedStylesHost.addStyles(this._styles);
if (this.componentProto.encapsulation === ViewEncapsulation.Emulated) {
this._contentAttr = shimContentAttribute(styleShimId);
this._hostAttr = shimHostAttribute(styleShimId);