无法识别的表达式错误

Unrecognized expresssion error?

本文关键字:表达式 错误 识别      更新时间:2023-09-26
<li class ="block" ng-repeat="i in items | searchFor:searchString" id={{i.title}}>
        <a><img class="gallery" id={{i.title}} ng-src="{{i.image}}" title="{{i.title}}" /></a>
        <a href="{{i.image}}" download><button id="eye" title="Preview"></button></a>
        <p>{{i.title}}</p>
    </li>
<<p> 条目列表/strong>
$scope.items = [
 {
url: '#',
title: 'Mountain',
image: 'https://images.unsplash.com/photo-1443890923422-7819ed4101c0'
 }];

抛出错误

jquery.min.js:2 Uncaught Error:语法错误,无法识别的表达式:https://images.unsplash.com/photo-1443890923422-7819ed4101c0

我相信这里出现了错误

 <a href="{{i.image}}" download><button id="eye" title="Preview"></button></a>

尝试将href更改为ng-href

错误发生,因为您使用的是href而不是ng-href自从{{i。Image}}不被计算

https://docs.angularjs.org/api/ng/directive/ngHref