我對Angular 2仍然很陌生,並且想知道是否有方法讓組件「飛入」並在切換路線時讓另一個組件「飛出」。假設我有兩個組件:Test1Component和Test2Component以及兩條指向它們的路線。什麼是最好的方法來做到這一點?Angular - 頁面之間的動畫(更改路線之後)
1
A
回答
3
https://github.com/angular/angular/issues/9845#issuecomment-235799008
RC5 will hopefully be out this week, if not then next week.
For now (with RC5) you will need to do this for every component that is routed to and you want to add animations to:
@Component({ host: { '[@routeAnimation]': 'true' }, animations: [ trigger('routeAnimation', [ transition('* => void', animate(...)), transition('void => *', animate(...)) ]) ] }) class Cmp { }
Once we get
query()
and$variables
into animations then you can use<router-outlet>
with the URL API that I wrote above.
-1
我發現了大約在4.2角和高達路由動畫一個偉大的文章。
相關問題
- 1. Vue.js在setTimeout之後滾動到新頁面路線的頂部
- 2. 我如何在更改路線時爲頁面添加動畫?
- 3. UIScrollView在動畫後更改頁面
- 4. 在ggplot2的兩個面之間畫線
- 5. Angular 4路由更改動畫
- 6. 如何在路線之間進行滑動動畫
- 7. 動態更改頁面與2個靜態頁面之間的差異
- 8. 我怎麼之間的頁面,離子路線?
- 9. 鐵流路由器與流星之間的動畫頁面轉換
- 10. 菜單項之間畫線
- 11. Laravel更改/註冊之後的回家路線
- 12. 傳遞離子之間的頁面之間的數組2
- 13. 網頁在頁面之間滾動
- 14. GWT在頁面/面板之間滑動
- 15. Xamarin.forms頁面之間導航的自定義動畫?
- 16. Windows Phone 7:頁面之間的動畫過渡?
- 17. 頁面之間的動畫效果變化
- 18. 在頁面之間製作漂亮的動畫
- 19. 如何在動畫之後/期間應用剪輯路徑?
- 20. 選擇路線之間 - PHP
- 21. 更改:動畫內容之前
- 22. 動畫之間的延遲
- 23. 動畫之後的類型
- 24. jQuery的 - 動畫時,頁面更改
- 25. react-router在更改路由之前沒有等待動畫
- 26. silverlight控件之間的自動頁面
- 27. 頁面之間的平滑滾動
- 28. Scrool在頁面之間的活動
- 29. 如何在動畫之間更改TextBlock的Text屬性?
- 30. 更改Core Animation重複動畫之間的標籤文字
謝謝你,但你能告訴我如何正確綁定呢?它給了我這個錯誤:「不能綁定到'@routeAnimation',因爲它不是一個已知的本地屬性」。 – TheGuy
我還沒有嘗試過動畫。你檢查了https://angular.io/docs/ts/latest/guide/animations.html嗎? –