angular未能加载检查器中的资源错误

angular Failed to load resource error in inspector

本文关键字:资源 错误 检查 加载 angular      更新时间:2023-09-26

我正在使用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"/>

我在inspector中注意到我收到了Failed to load resource错误,但图像显示在我的浏览器上。有人知道到底是什么导致了这个问题吗。我是否正确引用了我的图像?

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