Angular ctorParameters,decorator等元数据,包含在ActivatedRouteSnapshot数据结构里
2023-09-14 09:04:03 时间
顾名思义,这个变量包含了一个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项目总结——angular + browserify + gulp + bower + less 架构分享
- 基于Angular创建后台数据模拟(译)
- [Angular 9] Custom CSS Variables binding
- [Angular] Some performance tips
- [Angular Directive] 1. Write an Angular Directive
- [Angular] Separating Structural Styles From Theme Styles - Making Components Themeable
- [AngularJS] Exploring the Angular 1.5 .component() method
- [Angular 2] ngFor
- [AngularJS] Consistency between ui-router states and Angular directives
- [Angular] Isolate Scope. 1
- Angular input控件的click事件响应处理的调用上下文
- 一段简单的JavaScript代码,模拟Angular数据绑定信息的解析和替换
- Angular应用启动时创建的injection token一览
- Angular Service依赖注入的一个具体例子
- 基于Angular创建后台数据模拟(译)
- 【Angular专题】——(1)Angular,孤傲的变革者