Angular如何判断某个DOM节点包含Directive
2023-09-14 09:02:58 时间
如下图所示:核心的逻辑位于下图isDirectiveHost函数中:
function isDirectiveHost(tNode) {
return (tNode.flags & 1 /* isDirectiveHost */) === 1 /* isDirectiveHost */;
}
上下文:ɵɵelementStart
flags:1,表示directive host:
这个tNode结构应该是Angular运行时根据Angular编译器处理TypeScript文件而生成的结果。
更多Jerry的原创文章,尽在:“汪子熙”:
相关文章
- [Angular] Update FormArray with patchValue
- [Angular] @ContentChildren and QueryList
- [Angular] ChangeDetection -- onPush
- [Angular] Angular i18n Alternative Expressions Support (select)
- [Angular 2] Using ng-model for two-way binding
- [Angular 2] Passing data to components with 'properties'
- [Angular] Directive. 1
- [AngularJS]25. Built-in Angular Services
- Angular.js 页面里的按钮点击事件处理
- atitit.React 优缺点 相比angular react是最靠谱的web ui组件化方案了
- Angular Ngrx Store 里 State 和 Reducer 的绑定关系是如何实现的
- 关于调用 Angular 属性指令 attribute Directive 是否需要带中括号的问题
- Angular router-outlet占位符层级结构的子节点,运行时是如何插入的