Async load routes data and build route instruction for Angular 2

前端 未结 4 1286
野性不改
野性不改 2020-12-08 23:44

I try to build dynamically routes from angular2 (fetch route config from server), after that I parse it and generate instruction for component route (I have parent routes co

4条回答
  •  眼角桃花
    2020-12-09 00:30

    Using Observables/Promises to provide route translations is not a reliable solution, hence the Angular router expects Route[] or Routes, but an HTTP request can only return an Observable/Promise.

    The Angular app gets initialized, but the retrieval process of route translations still goes on using Observables/Promises.

    As Thierry Templier said, to get your configuration before bootstrapping your application would solve the problem.

    Also, check the @ngx-i18n-router/core on github.

提交回复
热议问题