Angular 2: How to conditionally load a Component in a Route asynchronously?

前端 未结 6 655
花落未央
花落未央 2021-01-31 10:39

I\'d like to attach a component to a route asynchronously, given a condition.

The following example, which works (but is asynchronous), loads one compon

6条回答
  •  时光取名叫无心
    2021-01-31 11:12

    Angular 2 supports lazy loading at module level. Feature modules are loaded asynchronously, not component. You can make that component feature module. https://angular.io/docs/ts/latest/guide/ngmodule.html

提交回复
热议问题