[英]In angular js {{i.link}} for attribute href on element a showing w3c validation error
My Html code with Angular js: 我的带有Angular js的Html代码:
<li data-ng-repeat="i in items | searchFor:searchString | limitTo:limit" >
<p><a href="{{i.link}}" class="search-link">{{i.title}}</a></p>
<p>{{i.description}}</p>
<p><a class="small" href="{{i.link}}">{{i.link}}</a></p>
</li>
W3c Validation giving error like below : W3c验证给出如下错误:
Bad value {{i.link}} for attribute href on element a: Illegal character in path segment: { is not allowed. 元素a上属性href的值{{i.link}}错误:路径段中的非法字符:{不允许。
Use ng-href for this. 为此使用ng-href。 Angular will transform it to the correct value.
Angular会将其转换为正确的值。
https://docs.angularjs.org/api/ng/directive/ngHref https://docs.angularjs.org/api/ng/directive/ngHref
Finally - using data-ng-href will solve the problem with validation problems. 最后 - 使用data-ng-href将解决验证问题。 (Related SO question What is the difference between ng-app and data-ng-app? )
(相关问题请问ng-app和data-ng-app有什么区别? )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.