router
Uncaught Error: Template parse errors: 'router-outlet' is not a known element:
- If 'router-outlet' is an Angular component, then verify that it is part of this module.
- If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
- 解決方法
- 每個模塊中都添加
import { RouterModule } from '@angular/router';然后 import即可 - 【推薦】建立shared模塊 在分享模塊中導入
RouterModule然后導出,其他有使用<router-outlet></router-outlet>的模塊都導入 shared模塊
主要是導入RouterModule指令, 根據自己的寫法調整, 二者選一即可
