Angular应用bootstrap时的version检测机制
core.js里:
create(injector, projectableNodes, rootSelectorOrNode, ngModule) {ngModule = ngModule || this.ngModule;/** @type {?} */const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;/** @type {?} */const rendererFactory = (/** @type {?} */ (rootViewInjector.get(RendererFactory2, domRendererFactory3)));/** @type {?} */const sanitizer = rootViewInjector.get(Sanitizer, null);/** @type {?} */const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);// Determine a tag name used for creating host elements when this component is created// dynamically. Default to 'div' if this component did not specify any tag name in its selector./** @type {?} */const elementName = (/** @type {?} */ (this.componentDef.selectors[0][0])) || 'div';/** @type {?} */const hostRNode = rootSelectorOrNode ?locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation) :elementCreate(elementName, rendererFactory.createRenderer(null, this.componentDef), getNamespace$1(elementName));/** @type {?} */const rootFlags = this.componentDef.onPush ? 64 /* Dirty */ | 512 /* IsRoot */ :16 /* CheckAlways */ | 512 /* IsRoot */;// Check whether this Component needs to be isolated from other components, i.e. whether it// should be placed into its own (empty) root context or existing root context should be used.// Note: this is internal-only convention and might change in the future, so it should not be// relied upon externally./** @type {?} */const isIsolated = typeof rootSelectorOrNode === 'string' &&/^#root-ng-internal-isolated-\d+/.test(rootSelectorOrNode);/** @type {?} */const rootContext = createRootContext();// Create the root view. Uses empty TView and ContentTemplate./** @type {?} */const rootTView = createTView(0 /* Root */, -1, null, 1, 0, null, null, null, null, null);/** @type {?} */const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector);// rootView is the parent when bootstrapping// TODO(misko): it looks like we are entering view here but we don't really need to as// `renderView` does that. However as the code is written it is needed because// `createRootComponentView` and `createRootComponent` both read global state. Fixing those// issues would allow us to drop this.enterView(rootLView, null);/** @type {?} */let component;/** @type {?} */let tElementNode;try {/** @type {?} */const componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, hostRenderer);if (hostRNode) {if (rootSelectorOrNode) {setUpAttributes(hostRenderer, hostRNode, ['ng-version', VERSION.full]);}else {// If host element is created as a part of this function call (i.e. `rootSelectorOrNode`// is not defined), also apply attributes and classes extracted from component selector.// Extract attributes and classes from the first selector only to match VE behavior.const { attrs, classes } = extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);if (attrs) {setUpAttributes(hostRenderer, hostRNode, attrs);}if (classes && classes.length > 0) {writeDirectClass(hostRenderer, hostRNode, classes.join(' '));}}}tElementNode = (/** @type {?} */ (getTNode(rootTView, 0)));if (projectableNodes !== undefined) {/** @type {?} */const projection = tElementNode.projection = [];for (let i = 0; i < this.ngContentSelectors.length; i++) {/** @type {?} */const nodesforSlot = projectableNodes[i];// Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade// case). Here we do normalize passed data structure to be an array of arrays to avoid// complex checks down the line.// We also normalize the length of the passed in projectable nodes (to match the number of// <ng-container> slots defined by a component).projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);}}// TODO: should LifecycleHooksFeature and other host features be generated by the compiler and// executed here?// Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcrefcomponent = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);renderView(rootTView, rootLView, null);}finally {leaveView();}/** @type {?} */const componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);if (!rootSelectorOrNode || isIsolated) {// The host element of the internal or isolated root view is attached to the component's host// view node.ngDevMode && assertNodeOfPossibleTypes(rootTView.node, 2 /* View */);(/** @type {?} */ (rootTView.node)).child = tElementNode;}return componentRef;}
}
Angular版本号维护在VERSION变量里:
Angular应用bootstrap时的version检测机制相关推荐
- git提交时由于eslint的检测机制报错:npm run lint-staged:js found some errors
git提交时报了两条错误: 1.stylelint --syntax less found some errors. Please fix them and try committing again ...
- netty的编解码、粘包拆包问题、心跳检测机制原理
文章目录 1. 编码解码器 2. 编解码序列化机制的性能优化 3. Netty粘包拆包 4. Netty心跳检测机制 5. Netty断线自动重连实现 1. 编码解码器 当你通过netty发送或者接受 ...
- Netty -Netty心跳检测机制案例,Netty通过WebSocket编程实现服务器和客户端长链接
Netty心跳检测机制案例 案例要求 编写一个Netty心跳检测机制案例,当服务器超过3秒没有读时,就提示读空闲 当服务器超过5秒没有写操作时,提示写空闲 服务器超过7秒没有读或者写操作时,就提示读写 ...
- U3D-页游-检测机制-webplayer-调试方法
文章目录[点击展开](?)[+] 前言 页游目前有两个客户端入口: 网页端 (unity webplayer) 游戏微端 (unity standalone) 关于微端的技术,可参考我之前的文章: d ...
- Netty(八) Netty心跳检测机制
1.什么是长链接和短链接 在HTTP/1.0中默认使用短连接.也就是说,客户端和服务器每进行一次HTTP操作,就建立一次连接,任务结束就中断连接.当客户端浏览器访问的某个HTML或其他类型的Web页中 ...
- Netty心跳检测机制
一.Netty心跳检测机制 心跳:即在 TCP 长连接中,客户端和服务器之间定期发送的一种特殊的数据包,通知对方自己还在线,以确保 TCP 连接的有效性. 在 Netty 中,实现心跳机制的关键是 I ...
- Netty教程07:心跳检测机制
需求:编写一个 Netty心跳检测机制案例, 当服务器超过3秒没有读时,就提示读空闲 当服务器超过5秒没有写操作时,就提示写空闲 实现当服务器超过7秒没有读或者写操作时,就提示读写空闲 Server ...
- Tensorflow_yolov3 Intel Realsense D435奇怪的现象,多摄像头连接时一旦能检测到深度马上就会卡(卡住)
两个摄像头连接时一旦能检测到深度马上就会卡(小于30公分),,单个摄像头没事,这是使用了多线程传输后的现象,不知咋回事... 后来加了这句验证全局变量是否存在,好像好点了,有待验证 20200401 ...
- Linux中基于eBPF的恶意利用与检测机制(rootkit、驱动)
目录 前言 现状分析 海外资料 国内资料 eBPF技术恶意利用的攻击原理 网络层恶意利用 Linux系统运行时恶意利用 综述 检测防御 运行前 运行时 运行后 防御 工程实现 系统兼容性 CO-RE ...
最新文章
- usaco ★Subset Sums 集合
- 移动app测试的多样性_app移动端接口性能测试
- 利用注解 + 反射消除重复代码,妙!
- 圈钱跑路 发行自己的ERC20 Token
- PAT 乙级1001 害死人不偿命的(3n+1)猜想
- beego模板语法循环html块,beego 模版语法
- 电脑的ip地址经常变化_电脑网络:分分钟通俗了解网关、DNS、子网掩码、MAC地址、DHCP...
- typescript的基本结构_上帝视角看 TypeScript
- Shiro(三)——三种不同的登录方式、RememberMe登录、Shiro 授权、其他配置(配置注销后的跳转页面、处理 JsessionID)
- 综合布线系统施工规范
- Linux文本处理工具之cut命令
- VScode中Paste Image插件无法使用
- python+selenium3登录126邮箱并发送邮件
- 使用安卓模拟器时提示关闭hyper-v
- python实现水滴筹页面的数据统计
- Logstash学习
- 啦啦外卖短信验证修复 短信提示:Specified signature is not matched with our calculation……
- 任时光匆匆流走。。。。
- vscode最强摸鱼指南,老板站在身后也看不出来的那种
- 阿里云发布三大人工智能产品,构建最全AI平台
热门文章
- sql 2012先分离迁移mdf mlf 文件到别的机器后附加 数据库成只读的修复方法
- Struts2 学习系列 (2) 访问web资源
- HDU(1572),最短路,DFS
- IDEA_Debug_checks references injected by intellilang plugin
- jquery验证表单 提交表单
- DHCP***的防御处理总结
- CCNP精粹系列之十六--实现三层交换的vlan间通信和路由器的配合使用
- JavaScript If…Else 语句
- Hadoop配置学习
- 我对XCode Objective-c Cocoa的简单理解