gpt4 book ai didi

javascript - Angular 无法在检查器中加载资源错误

转载 作者:行者123 更新时间:2023-11-28 20:09:21 25 4
gpt4 key购买 nike

我正在使用 Angular 的 ng-repeat 上传虚拟内容。

var app = angular.module("homeApp", []);
app.controller("entriesView", function ($scope){
$scope.itemEntry = [
{
image: "img/112013-priscilla-600.jpg",
title: "ymc",
logo: "http://www.youmustcreate.com/site/wp-content/themes/youmustcreate/images/core/header-logo.jpg"
},

{
image: "https://cms.myspacecdn.com/cms/x/13/47/112013-priscilla-600.jpg"
}
];

});

HTML

<section class="miniframe-wrapper" ng-controller="entriesView">
<section ng-repeat="itemEntry in itemEntry" class="miniframe">
<img src="{{itemEntry.image}}" alt="img"/>

我注意到在检查器中我收到无法加载资源错误,但是图像出现在我的浏览器上。有谁知道到底是什么导致了这个问题。我正确引用了我的图像吗?

最佳答案

使用字符串插值时,在图像标签中使用 ng-src 而不是 src。 ng-src 解析字符串,然后将 src 分配给标签,而 vanilla html 正在寻找名为“{{dataEntry.image}}”的图像

关于javascript - Angular 无法在检查器中加载资源错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20168366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com