Last active
July 22, 2018 07:56
-
-
Save aliyome/a9eaa2b08b74e7829feaadb6c66e7484 to your computer and use it in GitHub Desktop.
ルーティングアニメーション angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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