Angularjs 我的ng重复使用坏链接
我正在使用平均堆栈开发一个web应用程序,它完成了99%,除了这个一直困扰我的持久错误。我已经把它部署到 我的问题是,当您搜索位置时,web控制台将始终抛出以下错误:Angularjs 我的ng重复使用坏链接,angularjs,Angularjs,我正在使用平均堆栈开发一个web应用程序,它完成了99%,除了这个一直困扰我的持久错误。我已经把它部署到 我的问题是,当您搜索位置时,web控制台将始终抛出以下错误: GET https://find-nightlife.herokuapp.com/%7B%7Bplace.rating_img_url%7D%7D 404 (Not Found) %7B%7Bplace.image_url%7D%7D:1 GET https://find-nightlife.herokuapp.com/%7B%
GET https://find-nightlife.herokuapp.com/%7B%7Bplace.rating_img_url%7D%7D 404 (Not Found)
%7B%7Bplace.image_url%7D%7D:1 GET https://find-nightlife.herokuapp.com/%7B%7Bplace.image_url%7D%7D 404 (Not Found)
github上完整代码的链接在这里
有关守则:
<section class = "results">
<div ng-repeat = "place in results track by $index | limitTo: 10" class = "resultContainer">
<div class = "resultsList">
<div class = "placeImg"><img src = "{{place.image_url}}" alt = "{{place.name}}"/></div>
<div class = "placeAbout">
<div class = "placeName">
<a href = "{{place.url}}">{{place.name}}</a> <img src = "{{place.rating_img_url}}" /></div>
<div class = "placeSnippet">{{place.snippet_text}}</div>
</div>
<div class = "areyouGoing"><span style = "color: red">{{error}}</span> {{place.going}} Going
<button class = "placeGo notGo" ng-click = "plusOne(place, $index)" ng-show = "attend($index)">Not Going</button>
<button class = "placeGo letsGo" ng-click = "plusOne(place, $index)" ng-hide = "attend($index)">Let's Go!</button>
</div>
</div>
<div class = "divider" ng-hide="$last"></div>
</div>
{{place.snippet_text}
{{error}}{{place.go}}}go
不去
走吧!
app.controller('NightLifeCtrl'[
“$scope”,
"叫喊",,
“auth”,
函数($scope、yelp、auth){
if(yelp.places.data){
var attendanceIndex=[];
yelp.bar.forEach(函数(bar){
if(bar.people.indexOf(auth.currentUser())<0){
attendanceIndex.push(0);
}否则{
attendanceIndex.push(1);
}
})
$scope.attent=函数(num){
如果(attendanceIndex[num]==1){
返回true;
}否则{
返回false;
}
}
$scope.results=yelp.bar;
$scope.plusOne=函数(位置,数量){
如果(!auth.isLoggedIn()){
$scope.error='您必须登录!';
返回;
}
yelp.addOne(地点);
如果(attendanceIndex[num]==1){
返回attendanceIndex[num]=1;
}否则{
返回attendanceIndex[num]+=1;
}
}
}
}
]);
所有angular.js都在public/js/scripts.js中,最新版本在public/nightlife.html中,主页在views/index.ejs中
谢谢你的帮助 在href属性中包含
{{}}
时,始终使用ng href=“
属性
这将阻止大多数不必要的行为
这是我的建议
引用文件:
错误的书写方式:
<a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
<a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
正确的书写方法:
<a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
<a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
将
替换为
。ng src属性支持动态内容。谢谢,我不知道!现在一切正常。