引言 Anguar 16 引入一個(gè)有趣的功能,可以將路由器數(shù)據(jù)直接通過(guò)@Input來(lái)綁定,例如:QueryString,路由參數(shù),data靜態(tài)數(shù)據(jù)。 舊寫(xiě)法 在Angular 16 之前,需要通過(guò)ActivatedRoute來(lái)獲取這些數(shù)據(jù)。假設(shè)有這么一個(gè)路由配置: 1 2 3 4 5 { path:':type', component: TestComponent, data: { role:'admin'} } 并通過(guò)以下...
www.dbjr.com.cn/javascript/293362v...htm 2025-5-17