Skip to content

Instantly share code, notes, and snippets.

@aliyome
Last active July 22, 2018 07:56
Show Gist options
  • Save aliyome/a9eaa2b08b74e7829feaadb6c66e7484 to your computer and use it in GitHub Desktop.
Save aliyome/a9eaa2b08b74e7829feaadb6c66e7484 to your computer and use it in GitHub Desktop.
ルーティングアニメーション angular
const routes: Routes = [
{path: 'hoge', component: HogeComponent, data: {depth:1}},
{path: 'foo', component: HogeComponent, data: {depth:2}},
{path: 'bar', component: HogeComponent, data: {depth:3}},
];
...
@Component({
template: `
<!-- getDepth(outlet) -->
<div class="router-container" [@routeAnimation]="getDepth(outlet)">
<!-- #outletには NgRouterOutletが(exportAs: 'outlet')なので入っている -->
<router-outlet #outlet="outlet"></router-outlet>
</div>`
animations: [
trigger('routeAnimation', [
transition('1 => 2', [
])
])
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment