[英]How can I add a camelcase attribute to a dom element via an Angular 6 directive?
似乎不可能。 在两种情况下elementRef.nativeElement.setAttibute(camelCaseAttribute, "true")
无论我使用@HostBinding
还是elementRef.nativeElement.setAttibute(camelCaseAttribute, "true")
, camelCaseAttribute都会在呈现的dom中变为camelcaseattribute 。
我要做的就是使用指令设置ngDraggable ,这为什么不可能呢? ( ngdraggable无效)
非常感谢。
HTML属性不区分大小写。 所以没关系。
HTML元素的属性名称可以用小写和大写字母的任意组合来编写,这些大小写与本文档的HTML元素部分中给出的属性名称不区分大小写; 也就是说,属性名称不区分大小写。
来源: http : //w3c.github.io/html-reference/documents.html
如果您尝试有条件地添加ngDraggable
指令,我认为这不是一个好方法。 恕我直言,您应该问另一个问题,如何动态应用ngDraggable
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.