无法识别的表达错误?

时间:2016-08-26 00:42:05

标签: javascript html angularjs

<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>

项目列表

$scope.items = [
 {
url: '#',
title: 'Mountain',
image: 'https://images.unsplash.com/photo-1443890923422-7819ed4101c0'
 }];

这会抛出错误

  

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

2 个答案:

答案 0 :(得分:0)

我相信错误发生在这里

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

尝试将href更改为ng-href

答案 1 :(得分:0)

由于您使用href而不是ng-href,因为{{i.image}}未被评估,因此发生错误

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