在創(chuàng)建組件時:
news組件中還有兩個子組件,newsadd組件中還有兩個子組件

在配置路由時,配置子路由關(guān)鍵字:children
const?routes:?Routes?=?[
{path:'home',component:HomeComponent},
{path:'news',component:NewsComponent,
//引入子路由
?children:[
??{path:'newspage',component:NewspageComponent},
????{path:'welcome',component:WelcomeComponent}
?]
},
{path:'newsadd',component:NewsaddComponent,
??children:[
????{path:'newsaddwelcom??',component:NewsaddwelcomComponent},
????{path:'systemset',component:SystemsetComponent}
??]
},
{path:'**',redirectTo:'home'}
? ?注意要想掛在子組件同時發(fā)布子路由:
父組件的html中掛載? ? :
<router-outet></router-outet>
html構(gòu)成:;兩個路由的鏈接,div中是子組件展示內(nèi)容的地方,所以需要將子組件掛載在那。

此筆記均屬于自己學(xué)習(xí)angular的理解,純粹為了記錄自己的想法,方便查閱,如有錯誤的地方請勿見怪,歡迎指出。