Skip to content

Commit c0c47e3

Browse files
Example of using BrowserAnimationsModule
1 parent e5f1299 commit c0c47e3

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/angular/ClientApp/app/app.module.browser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33
import { AppModuleShared } from './app.module.shared';
44
import { AppComponent } from './components/app/app.component';
5+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
56

67
@NgModule({
78
bootstrap: [ AppComponent ],
89
imports: [
910
BrowserModule,
10-
AppModuleShared
11+
AppModuleShared,
12+
BrowserAnimationsModule
1113
],
1214
providers: [
1315
{ provide: 'BASE_URL', useFactory: getBaseUrl }

templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/angular/ClientApp/app/app.module.server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { NgModule } from '@angular/core';
22
import { ServerModule } from '@angular/platform-server';
33
import { AppModuleShared } from './app.module.shared';
44
import { AppComponent } from './components/app/app.component';
5+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
56

67
@NgModule({
78
bootstrap: [ AppComponent ],
89
imports: [
910
ServerModule,
10-
AppModuleShared
11+
AppModuleShared,
12+
NoopAnimationsModule
1113
]
1214
})
1315
export class AppModule {

templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/angular/ClientApp/app/components/fetchdata/fetchdata.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1>Weather forecast</h1>
1414
</tr>
1515
</thead>
1616
<tbody>
17-
<tr *ngFor="let forecast of forecasts">
17+
<tr *ngFor="let forecast of forecasts" [@itemAnim]>
1818
<td>{{ forecast.dateFormatted }}</td>
1919
<td>{{ forecast.temperatureC }}</td>
2020
<td>{{ forecast.temperatureF }}</td>

templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/angular/ClientApp/app/components/fetchdata/fetchdata.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
import { Component, Inject } from '@angular/core';
22
import { Http } from '@angular/http';
3+
import { trigger, style, transition, animate } from '@angular/animations';
34

45
@Component({
56
selector: 'fetchdata',
6-
templateUrl: './fetchdata.component.html'
7+
templateUrl: './fetchdata.component.html',
8+
animations: [
9+
trigger('itemAnim', [
10+
transition(':enter', [
11+
style({ transform: 'translateX(-100%)' }),
12+
animate(350)
13+
])
14+
])
15+
]
716
})
817
export class FetchDataComponent {
918
public forecasts: WeatherForecast[];

0 commit comments

Comments
 (0)