I'm tying to create a component which has a <time/>
tag in it. And I'm trying to binding to its datetime
attribute. Sample:
// component:
String isoFormat;
<!-- html template: -->
<time datetime="{{isoFormat}}">{{display}}</time>
But, I'm getting this compile-time error:
ParseErrorLevel.FATAL: Can't bind to 'datetime' since it isn't a known native property or known directive. Please fix typo or add to directives list.
Is there any fix for that? Or I should drop it? Thanks in advance.
Since datetime is a native HTML5 attribute, did you try prefixing it with attr.
?
E.g.:
<time [attr.datetime]="isoFormat">{{display}}</time>
See here: https://webdev.dartlang.org/angular/guide/template-syntax#other-bindings