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