fix(animations): make animations work in AOT (#14775)

This commit is contained in:
Matias Niemelä
2017-03-01 17:13:06 -08:00
committed by Igor Minar
parent 3168ef75da
commit 9560ad81b9
13 changed files with 119 additions and 60 deletions

View File

@ -5,12 +5,8 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AUTO_STYLE, Component, animate, state, style, transition, trigger} from '@angular/core';
export function anyToAny(stateA: string, stateB: string): boolean {
return Math.random() != Math.random();
}
import {AUTO_STYLE, animate, state, style, transition, trigger} from '@angular/animations';
import {Component} from '@angular/core';
@Component({
selector: 'animate-cmp',
@ -20,7 +16,7 @@ export function anyToAny(stateA: string, stateB: string): boolean {
state('*', style({height: AUTO_STYLE, color: 'black', borderColor: 'black'})),
state('closed, void', style({height: '0px', color: 'maroon', borderColor: 'maroon'})),
state('open', style({height: AUTO_STYLE, borderColor: 'green', color: 'green'})),
transition(anyToAny, animate('1s')), transition('* => *', animate(500))
transition('* => *', animate('1s'))
])],
template: `
<button (click)="setAsOpen()">Open</button>

View File

@ -8,9 +8,9 @@
import {ApplicationRef, NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {ServerModule} from '@angular/platform-server';
import {MdButtonModule} from '@angular2-material/button';
// Note: don't refer to third_party_src as we want to test that
// we can compile components from node_modules!
import {ThirdpartyModule} from 'third_party/module';
@ -50,6 +50,7 @@ import {CompForChildQuery, CompWithChildQuery, CompWithDirectiveChild, Directive
ComponentUsingThirdParty,
],
imports: [
NoopAnimationsModule,
ServerModule,
FormsModule,
MdButtonModule,