Issue 1:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When i use animations in HTML, SSR crashes.

I have my animation defined and used in html like this

<div [@flyIn]></div>

I have browser module which imports import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

I received error on server

Error: Found the synthetic property @flyin. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.

When i import in server module import {NoopAnimationsModule} from '@angular/platform-browser/animations';

i receive another error which cause crash of server.

EXCEPTION: document is not defined

ORIGINAL STACKTRACE:

ReferenceError: document is not defined

at DefaultDomRenderer2.selectRootElement (F:\git\ng-universal-demo\dist\server.js:31873:72)

at createElement (F:\git\ng-universal-demo\dist\server.js:9067:23)

at createViewNodes (F:\git\ng-universal-demo\dist\server.js:11533:44)

at createRootView (F:\git\ng-universal-demo\dist\server.js:11480:5)

at Object.createProdRootView [as createRootView] (F:\git\ng-universal-demo\dist\server.js:12049:12)

at ComponentFactory_.create (F:\git\ng-universal-demo\dist\server.js:9485:46)

at ApplicationRef_.bootstrap (F:\git\ng-universal-demo\dist\server.js:4862:57)

at F:\git\ng-universal-demo\dist\server.js:4657:89

at Array.forEach (native)

at PlatformRef_.moduleDoBootstrap (F:\git\ng-universal-demo\dist\server.js:4657:42)

at F:\git\ng-universal-demo\dist\server.js:4620:27

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59567:26)

at Object.onInvoke (F:\git\ng-universal-demo\dist\server.js:4017:37)

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59566:32)

at Zone.run (F:\git\ng-universal-demo\dist\server.js:59359:43)

Unhandled Promise rejection: document is not defined ; Zone: ; Task: Promise.then ; Value: { ReferenceError: document is not defined

at DefaultDomRenderer2.selectRootElement (F:\git\ng-universal-demo\dist\server.js:31873:72)

at createElement (F:\git\ng-universal-demo\dist\server.js:9067:23)

at createViewNodes (F:\git\ng-universal-demo\dist\server.js:11533:44)

at createRootView (F:\git\ng-universal-demo\dist\server.js:11480:5)

at Object.createProdRootView [as createRootView] (F:\git\ng-universal-demo\dist\server.js:12049:12)

at ComponentFactory.create (F:\git\ng-universal-demo\dist\server.js:9485:46)

at ApplicationRef_.bootstrap (F:\git\ng-universal-demo\dist\server.js:4862:57)

at F:\git\ng-universal-demo\dist\server.js:4657:89

at Array.forEach (native)

at PlatformRef_._moduleDoBootstrap (F:\git\ng-universal-demo\dist\server.js:4657:42)

at F:\git\ng-universal-demo\dist\server.js:4620:27

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59567:26)

at Object.onInvoke (F:\git\ng-universal-demo\dist\server.js:4017:37)

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59566:32)

at Zone.run (F:\git\ng-universal-demo\dist\server.js:59359:43)

__zone_symbol__currentTask:

ZoneTask {

zone:

Zone {

_properties: {},

parent: null,

name: '',

zoneDelegate: [Object] },

runCount: 0,

zoneDelegates: null,

state: 'notScheduled',

type: 'microTask',

source: 'Promise.then',

data: undefined,

scheduleFn: undefined,

cancelFn: null,

callback: [Function],

invoke: [Function] } } ReferenceError: document is not defined

at DefaultDomRenderer2.selectRootElement (F:\git\ng-universal-demo\dist\server.js:31873:72)

at createElement (F:\git\ng-universal-demo\dist\server.js:9067:23)

at createViewNodes (F:\git\ng-universal-demo\dist\server.js:11533:44)

at createRootView (F:\git\ng-universal-demo\dist\server.js:11480:5)

at Object.createProdRootView [as createRootView] (F:\git\ng-universal-demo\dist\server.js:12049:12)

at ComponentFactory.create (F:\git\ng-universal-demo\dist\server.js:9485:46)

at ApplicationRef.bootstrap (F:\git\ng-universal-demo\dist\server.js:4862:57)

at F:\git\ng-universal-demo\dist\server.js:4657:89

at Array.forEach (native)

at PlatformRef.moduleDoBootstrap (F:\git\ng-universal-demo\dist\server.js:4657:42)

at F:\git\ng-universal-demo\dist\server.js:4620:27

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59567:26)

at Object.onInvoke (F:\git\ng-universal-demo\dist\server.js:4017:37)

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59566:32)

at Zone.run (F:\git\ng-universal-demo\dist\server.js:59359:43)

{ Error: Uncaught (in promise): ReferenceError: document is not defined

ReferenceError: document is not defined

at DefaultDomRenderer2.selectRootElement (F:\git\ng-universal-demo\dist\server.js:31873:72)

at createElement (F:\git\ng-universal-demo\dist\server.js:9067:23)

at createViewNodes (F:\git\ng-universal-demo\dist\server.js:11533:44)

at createRootView (F:\git\ng-universal-demo\dist\server.js:11480:5)

at Object.createProdRootView [as createRootView] (F:\git\ng-universal-demo\dist\server.js:12049:12)

at ComponentFactory.create (F:\git\ng-universal-demo\dist\server.js:9485:46)

at ApplicationRef.bootstrap (F:\git\ng-universal-demo\dist\server.js:4862:57)

at F:\git\ng-universal-demo\dist\server.js:4657:89

at Array.forEach (native)

at PlatformRef.moduleDoBootstrap (F:\git\ng-universal-demo\dist\server.js:4657:42)

at F:\git\ng-universal-demo\dist\server.js:4620:27

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59567:26)

at Object.onInvoke (F:\git\ng-universal-demo\dist\server.js:4017:37)

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59566:32)

at Zone.run (F:\git\ng-universal-demo\dist\server.js:59359:43)

at resolvePromise (F:\git\ng-universal-demo\dist\server.js:59898:31) []

at resolvePromise (F:\git\ng-universal-demo\dist\server.js:59869:17) []

at F:\git\ng-universal-demo\dist\server.js:59946:17 []

at Zone.runTask (F:\git\ng-universal-demo\dist\server.js:59399:47) [ => ]

at drainMicroTaskQueue (F:\git\ng-universal-demo\dist\server.js:59779:35) []

at ZoneTask.invoke (F:\git\ng-universal-demo\dist\server.js:59657:25) []

at data.args.(anonymous function) (F:\git\ng-universal-demo\dist\server.js:60752:25) []

at FSReqWrap.oncomplete (fs.js:114:15) []

zone_symbol__error:

{ Error: Uncaught (in promise): ReferenceError: document is not defined

ReferenceError: document is not defined

at DefaultDomRenderer2.selectRootElement (F:\git\ng-universal-demo\dist\server.js:31873:72)

at createElement (F:\git\ng-universal-demo\dist\server.js:9067:23)

at createViewNodes (F:\git\ng-universal-demo\dist\server.js:11533:44)

at createRootView (F:\git\ng-universal-demo\dist\server.js:11480:5)

at Object.createProdRootView [as createRootView] (F:\git\ng-universal-demo\dist\server.js:12049:12)

at ComponentFactory.create (F:\git\ng-universal-demo\dist\server.js:9485:46)

at ApplicationRef.bootstrap (F:\git\ng-universal-demo\dist\server.js:4862:57)

at F:\git\ng-universal-demo\dist\server.js:4657:89

at Array.forEach (native)

at PlatformRef._moduleDoBootstrap (F:\git\ng-universal-demo\dist\server.js:4657:42)

at F:\git\ng-universal-demo\dist\server.js:4620:27

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59567:26)

at Object.onInvoke (F:\git\ng-universal-demo\dist\server.js:4017:37)

at ZoneDelegate.invoke (F:\git\ng-universal-demo\dist\server.js:59566:32)

at Zone.run (F:\git\ng-universal-demo\dist\server.js:59359:43)

at resolvePromise (F:\git\ng-universal-demo\dist\server.js:59898:31) []

at resolvePromise (F:\git\ng-universal-demo\dist\server.js:59869:17) []

at F:\git\ng-universal-demo\dist\server.js:59946:17 []

at Zone.runTask (F:\git\ng-universal-demo\dist\server.js:59399:47) [ => ]

at drainMicroTaskQueue (F:\git\ng-universal-demo\dist\server.js:59779:35) []

at ZoneTask.invoke (F:\git\ng-universal-demo\dist\server.js:59657:25) []

at data.args.(anonymous function) (F:\git\ng-universal-demo\dist\server.js:60752:25) []

at FSReqWrap.oncomplete (fs.js:114:15) []

Expected behavior

When i use animations in HTML, it will have no influence on SSR.

Minimal reproduction of the problem with instructions

Angular version: >=4.0.0-rc.3

Browser: [all]

Language: [TypeScript 2.2.1]

Node (for AoT issues): node --version = v7.7.1

Issue 2:
This will let animations work as a no-op on the server side when the AnimationModule included in the client app module.