角度2硬编码的所有HTML标签(Does angular 2 Hard Coded All HTML Tags)
我是Angular 2的新手,我很困惑的是Angular 2是否知道所有的HTML标签?
我的意思是如果在一个模板中有 ,并且我们知道
是一个有效的HTML 5元素,没有什么不对,但是如果我将元素更改为 ,解析期间发生异常。
那么Angular 2是否知道所有的HTML标签? 我不能使用自定义标签(不是Angular指令)?
解析器如何决定在元素上给出错误?
顺便说一下, 是一个有效的HTML 5元素,但如果我使用某些解析异常会再次发生,但是如果将其更改为一切都会顺利!
I'm new to Angular 2, something I'm confused about is whether Angular 2 knows all HTML tags?
I mean if in a template I have , and we know that
is a valid HTML 5 element, there is nothing wrong, but if I change the element to an exception occurs during parsing.
So does Angular 2 just knows all HTML tags? And can't I use custom tags (which are not Angular directives)?
How does the parser decide to give an error on an element?
By the way is a valid HTML 5 element but if I use some parsing exception occurs again, but if I change it to everything goes fine!
原文:https://stackoverflow.com/questions/42125876
更新时间:2019-09-05 06:46
最满意答案
如果你想允许自定义标签(不是组件选择器),你需要添加CUSTOM_ELEMENTS_SCHEMA到你的模块 - 看到这个答案
If you want to allow custom tags (that aren't component selectors), you'll need to add CUSTOM_ELEMENTS_SCHEMA to your module - see this answer
相关问答
解决静态文件问题的最简单方法是在HTML中引用它们时使用相对路径。 例如: 如果你愿意投入更多的工作,你可以通过编写一个微型服务器来显示你的模板来解决你所提到的所有设计时问题。 维护一个充满简单数据结构的文件,其中包含所有模板的示例值。 使用像Werkzeug这样的微型框架在本地机器上提供http。 编写一个根请求处理程序,用于扫描您的数据结构列表或模板目录,以生成包含指向所有模板链接的索引页面。 为非根请求编写二级请求处理程序,该请求
...
该网站提出额外的价格要求。 你应该模仿相同的请求。你可以在chrome network xhr标签下找到它。 不要使用硒类解决方案,因为废弃大量数据需要时间。 This website makes extra request for the price. You should imitiae the same request.You can find it under chrome network xhr tab. Don't use selenium kind of solution becau
...
这只有在你有相同的输入名称时才有可能, 用这个替换你的代码块并尝试:
{{data.name}} | {{data.bi}} ... 如果你想允许自定义标签(不是组件选择器),你需要添加CUSTOM_ELEMENTS_SCHEMA到你的模块 - 看到这个答案 If you want to allow custom tags (that aren't component selectors), you'll need to add CUSTOM_ELEMENTS_SCHEMA to your module - see this answer NewDev的评论很有帮助,我最终得到了以下方法,其中包含异步验证和模式。 app.directive('validationUrl', function($http, $parse, $q){ return { restrict: 'A', require: 'ngModel', link: function(scope, elem, attrs, ngModel) { ngModel.$asyncValidators.cus ... 在这种情况下,我经常明确地逃避不安全的部分: "» #{h @category.name}".html_safe In this situation I often explicitly escape the unsafe part: "» #{h @category.name}".html_safe 该值存储在Mono.Cecil.Cil.Instruction类的Operand字段中。 简短版本是更改它只需要分配该属性并保存程序集。 长版本是指令可能是OpCodes.Ldc_I4_S ,它只占用Operand一个OpCodes.Ldc_I4_S (-128到127),因此单独将其更改为int.MaxValue(2147483647)将不起作用。 如果这是一次性的,你也可以将Opcode更改为OpCodes.Ldc_I4然后你应该好好去。 如果您进行了许多更改,那么Mono.Cecil.Roc ... 将图像添加到您的班级: .class1 { display: inline-block; height: 32px; width: 32px; background-image: url(myimage.png); } Add an image to your class:
|
可能有数据库的列名称为ID或 ... 由于表单正在提交,您需要取消表单提交。 function e() { var x = document.getElementById("numberz"); var z = document.getElementById("num").value; //alert(x.innerHTML + " s " + z);// x.innerHTML= z; return ... |