前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Angular HTML template的解析位置

Angular HTML template的解析位置

作者头像
Jerry Wang
发布2020-08-14 09:50:33
1.4K0
发布2020-08-14 09:50:33
举报

文件:

compiler.umd.js

path:

turbo_modules/@angular/compiler@9.1.12/bundles:

函数名:TemplateParser.prototype.parse

代码语言:javascript
复制
TemplateParser.prototype.parse = function(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
                    var result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces);
                    var warnings = result.errors.filter(function(error) {
                        return error.level === exports.ParseErrorLevel.WARNING;
                    });
                    var errors = result.errors.filter(function(error) {
                        return error.level === exports.ParseErrorLevel.ERROR;
                    });
                    if (warnings.length > 0) {
                        this._console.warn("Template parse warnings:\n" + warnings.join('\n'));
                    }
                    if (errors.length > 0) {
                        var errorString = errors.join('\n');
                        throw syntaxError("Template parse errors:\n" + errorString, errors);
                    }
                    return {
                        template: result.templateAst,
                        pipes: result.usedPipes
                    };
                }

如果把form后面中括号的formGroup改成formGroup2:

错误消息:Can’t bind to ‘formGroup2’ since it isn’t a known property of ‘form’. ("

检查逻辑位于compiler.umd.js里的TemplateParseVisitor.prototype._checkPropertiesInSchema函数:

检查的具体细节:Schema里包含的form元数据:

报错:

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-08-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档