【发布时间】:2018-12-07 12:33:14
【问题描述】:
enter image description here我有一些错误。这是我的代码。 文件html:
<div ng-controller="newsCtrl">
<div class="row">
<div ng-repeat="x in news">
<div class="col-xs-6">
<div class="newsContent">{{x.content}}</div>
<div class="newsImage"><img src="../image/{{x.image}}" alt="vinfast oto"></div>
<div class="newsTitle">
<h2>{{x.title}}</h2>
</div>
</div>
<hr>
</div>
</div>
</div>
文件 app.js:
app.controller("newsCtrl", function ($scope, $http) {
$http({
method: "GET",
url: "http://localhost:8080/EX11_29112018_spring_restful/news"
}).then(function (response) {
$scope.news = response.data;
})
});
views 文件夹中的 HTML,js 文件夹中的 app.js,它们在 webapp 文件夹中。我的图像已加载,但出现此错误:加载资源失败:net::ERR_FILE_NOT_FOUND; 如何解决。
【问题讨论】:
-
您是否使用 ng-src 作为
<img ng-src="string"></img>? -
好的,非常感谢
-
它是否适用于更改??
-
是的,我试过了,效果很好
-
我会为其他人提供未来的答案,好的!请接受!