Angular 2 router resolve server request before opening a component

前端 未结 1 1538
迷失自我
迷失自我 2021-01-22 19:39

I have a BookDetailComponent component which is mapped for an url /books/:id. Is there any way in angular 2 router to make sure that this component is

相关标签:
1条回答
  • 2021-01-22 20:15

    Yes, by implementing the OnActivate interface and returning a promise of the object you are waiting to load:

    https://angular.io/docs/js/latest/api/router/OnActivate-interface.html

    0 讨论(0)
提交回复
热议问题