[英]set angular component variable value in an HTML5 data attribute
I have a我有一个
::before { content:attr(data-datetime) }
The Html that works:有效的 Html:
<li class="timeline-seperator" data-datetime="01/2020"></li>
The problem is that I would like the data-datetime attribute takes its value from the angular component function\variable (and not a fixed value as seen here)问题是我希望data-datetime属性从 angular 组件函数\变量中获取其值(而不是这里看到的固定值)
Is there a way to make it?有没有办法做到?
u can do it for custom attribute like attr.
你可以为像
attr.
to bind绑定
<li class="timeline-seperator" [attr.data-datetime]="name"></li>
or或者
<li class="timeline-seperator" attr.data-datetime="{{name}}"></li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.