我有一个离子1应用程序,即时尝试动态更改IMG源。我认为我必须做更新的范围链接到这个来源,但它没有奏效。任何想法可能是错误的?Img src不会改变当我更新源
my View
<div ng-if="isList" class="item style-list" ng-repeat="(key, item) in items"
ng-click="goTo(item)">
<div class="img-container" ng-if="isList">
<m-img encode="true" src="item.image"></m-img>
</div>
<h1 ng-bind="item.title"></h1>
<p ng-bind="item.resume" ng-if="item.resume"></p>
<p ng-bind-html="stripHtml(item.description) | mCut:100" ng-if="!item.resume"></p>
</div>
my Controller
$scope.$on("update-data", function(event, args) {
$scope.items[1].description =
args.response.results[0].item.description;
$scope.items[1].id = args.response.results[0].item.id;
$scope.items[1].image = args.response.results[0].item.image;
$scope.items[1].resume = args.response.results[0].item.resume;
$scope.items[1].title = args.response.results[0].item.title;
});
我的M-IMG组件
html
<div class="thumb-size notloaded">
<div class="thumb" ng-if="imgStyle" ion-img-cache-bg ng-
style="imgStyle">
</div>
</div>
我的M-IMG JS还挺丰富的,在这里https://codeshare.io/adABMe
并购后,IMG组件 – Karim
的代码只是贴吧! –
我以前没有和Ionic一起工作过,但是您是否尝试过[使用ng-src](https://docs.angularjs.org/api/ng/directive/ngSrc)? –