与 angular 2.0.0-beta.0 一起使用时,自定义属性会出现解析错误

Custom attribute gives parsing error when using with an angular 2.0.0-beta.0

我正在尝试将自定义属性与 angular2 一起使用,如下所示

 <a href="javascript:void(0)" title="{{inst.title}}" data-loc="{{inst.actionval}}">

这给了我以下错误

EXCEPTION: Template parse errors: Can't bind to 'loc' since it isn't a known native property

Angular 默认使用 属性 绑定,但 a 没有 属性 数据位置。要明确告诉 Angular 使用属性绑定,请改用: 试试这个可能适合你。

<a href="javascript:void(0)" title="{{inst.title}}" [attr.data-loc]="inst.actionval">

<a href="javascript:void(0)" title="{{inst.title}}" attr.data-loc="{{inst.actionval}}">