Compare commits

...

1 Commits

Author SHA1 Message Date
Steve Sanderson
c0c47e3def Example of using BrowserAnimationsModule 2017-08-24 15:44:56 -07:00
4 changed files with 17 additions and 4 deletions

View File

@@ -2,12 +2,14 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { AppModuleShared } from './app.module.shared'; import { AppModuleShared } from './app.module.shared';
import { AppComponent } from './components/app/app.component'; import { AppComponent } from './components/app/app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({ @NgModule({
bootstrap: [ AppComponent ], bootstrap: [ AppComponent ],
imports: [ imports: [
BrowserModule, BrowserModule,
AppModuleShared AppModuleShared,
BrowserAnimationsModule
], ],
providers: [ providers: [
{ provide: 'BASE_URL', useFactory: getBaseUrl } { provide: 'BASE_URL', useFactory: getBaseUrl }

View File

@@ -2,12 +2,14 @@ import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server'; import { ServerModule } from '@angular/platform-server';
import { AppModuleShared } from './app.module.shared'; import { AppModuleShared } from './app.module.shared';
import { AppComponent } from './components/app/app.component'; import { AppComponent } from './components/app/app.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({ @NgModule({
bootstrap: [ AppComponent ], bootstrap: [ AppComponent ],
imports: [ imports: [
ServerModule, ServerModule,
AppModuleShared AppModuleShared,
NoopAnimationsModule
] ]
}) })
export class AppModule { export class AppModule {

View File

@@ -14,7 +14,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let forecast of forecasts"> <tr *ngFor="let forecast of forecasts" [@itemAnim]>
<td>{{ forecast.dateFormatted }}</td> <td>{{ forecast.dateFormatted }}</td>
<td>{{ forecast.temperatureC }}</td> <td>{{ forecast.temperatureC }}</td>
<td>{{ forecast.temperatureF }}</td> <td>{{ forecast.temperatureF }}</td>

View File

@@ -1,9 +1,18 @@
import { Component, Inject } from '@angular/core'; import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http'; import { Http } from '@angular/http';
import { trigger, style, transition, animate } from '@angular/animations';
@Component({ @Component({
selector: 'fetchdata', selector: 'fetchdata',
templateUrl: './fetchdata.component.html' templateUrl: './fetchdata.component.html',
animations: [
trigger('itemAnim', [
transition(':enter', [
style({ transform: 'translateX(-100%)' }),
animate(350)
])
])
]
}) })
export class FetchDataComponent { export class FetchDataComponent {
public forecasts: WeatherForecast[]; public forecasts: WeatherForecast[];