3
我想在我的Angular 2材質(角度/材質2)應用程序中添加一些路由器動畫。 沒有動畫所有工作正常,但當我將它們添加到我的組件內容溢出視口和滾動行爲不再工作。Angular 2材質 - 路由器動畫打破了sidenav內容並滾動
要添加動畫,我已經定義了一個TS文件router.animations.ts:
import { AnimationEntryMetadata, trigger, state, animate, style, transition } from "@angular/core";
export function slideToLeft(): AnimationEntryMetadata {
"use strict";
return trigger("slideToLeft", [
state("void", style({ position: "fixed", width: "100%" })),
state("*", style({ position: "fixed", width: "100%" })),
transition(":enter", [
style({ transform: "translateX(100%)" }),
animate("0.5s ease-in-out", style({ transform: "translateX(0%)" }))
]),
transition(":leave", [
style({ transform: "translateX(0%)" }),
animate("0.5s ease-in-out", style({ transform: "translateX(-100%)" }))
])
]);
}
然後我的組件裏面:
import { Component } from "@angular/core";
import { slideToLeft } from "./router.animations";
@Component({
selector: "home",
templateUrl: "src/home.component.html",
animations: [slideToLeft()],
host: { "[@slideToLeft]": "" }
})
export class HomeComponent {
constructor() {
}
}
這裏是一個plunker這說明問題:
https://plnkr.co/edit/Vz1iqSmcWwu3QG65Qxgw?p=preview
何我能解決這個問題嗎?
您有沒有點這個問題? – antonyboom