angular2 html标签,角度2硬编码的所有HTML标签(Does angular 2 Hard Coded All HTML Tags)

角度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中引用它们时使用相对路径。 例如: image.jpg 如果你愿意投入更多的工作,你可以通过编写一个微型服务器来显示你的模板来解决你所提到的所有设计时问题。 维护一个充满简单数据结构的文件,其中包含所有模板的示例值。 使用像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:

  • ...

    听起来像你可以使用php脚本处理程序实现一个jQuery“就地编辑”插件。 我做了一些正确的事情,他们的插件完成了所有繁重的工作,所有你需要做的就是用表格结构的各种线索输出原始的HTML。 看到这个SO q / a ...我用它来生成显示订单的页面。 通过编辑,我下了订单(点击编辑)。 在代码中,将所有内容放在foreach循环中,然后jQuery通过

可能有数据库的列名称为ID或

...

由于表单正在提交,您需要取消表单提交。 function e() {

var x = document.getElementById("numberz");

var z = document.getElementById("num").value;

//alert(x.innerHTML + " s " + z);//

x.innerHTML= z;

return

...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值