Angular ctorParameters,decorator等元数据,包含在ActivatedRouteSnapshot数据结构里
生活随笔
收集整理的這篇文章主要介紹了
Angular ctorParameters,decorator等元数据,包含在ActivatedRouteSnapshot数据结构里
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
顧名思義,這個(gè)變量包含了一個(gè)Angular Component構(gòu)造函數(shù)的參數(shù)。看一個(gè)例子:
我有一個(gè)PageLayoutComponent:構(gòu)造函數(shù)有一個(gè)參數(shù)pageLayoutService,類型為PageLayoutService:
ctorParameters的值,是這個(gè)函數(shù)的返回值,一個(gè)數(shù)組,里面包含唯一一個(gè)元素:
這個(gè)Component的decorator:
@Component({selector: 'cx-page-layout',templateUrl: './page-layout.component.html',changeDetection: ChangeDetectionStrategy.OnPush, })一個(gè)set屬性,加了@Input的注解:
factory指向的是Component的構(gòu)造函數(shù):
function location:點(diǎn)擊之后能進(jìn)到Component的源代碼位置:
Scopes:能查看閉包信息
加了@Input注解的屬性:
在routeConfig參數(shù)里,能看到每個(gè)路由路徑的字符串,和對應(yīng)應(yīng)該打開的Angular Component:
更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的Angular ctorParameters,decorator等元数据,包含在ActivatedRouteSnapshot数据结构里的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何对SAP Spartacus支持路由
- 下一篇: 百度地图 圈出省份轮廓图并高亮