1. 程式人生 > 實用技巧 >angular8 建立module 實現路由懶載入

angular8 建立module 實現路由懶載入

建立module test

ng g ng-alain:module test //預設在src/app/routes下建立module

自動生成ts模組和路由模組

在test模組中建立list列表元件和editb編輯頁元件

ng g ng-alain:list lisy -m=test

ng g ng-alain:edit edit -m=test -t=list

test路由模組新增路由如下

在跟路由模組下

通過loadchildren實現懶載入 點選選單才去請求頁面資料

loadChildren指向test模組