angularjs 与 nw.js 不工作。 ng-src 属性
angularjs with nw.js not working. ng-src attribute
ng-src 属性有问题。
我运行图片中本地主机上的项目显示正确。
<img width = "100%" ng-src = "{{item.poster}}">
但是如果我使用 nw.js 启动项目,则没有图片,只有文本值。
谁遇到过这个问题。告诉我怎么解决。
这是我重复的代码的全部代码
<div class="col-md-2 movie-con" style="padding:5px" ng-repeat="item in movie | filter:query">
<div class="col-md-12 img" style="padding:0;">
<img width="100%" ng-src="{{ item.poster }}">
</div>
<div class="col-md-12">
<span style="color:#AEAEAE;">{{ item.name }}</span>
</div>
</div>
您可以使用指令 "ng-if"。这是示例:
<div ng-app="myApp">
<div ng-controller="myCtrl">
<div ng-repeat="item in items" style="border: 1px solid blue; margin: 10px; display: inline-box;" >
<div ng-if="!item.url">
{{item.title}}
</div>
<div ng-if="item.url">
<img src="{{item.url}}" height=80 />
</div>
</div>
</div>
这是一个活生生的例子:http://jsfiddle.net/4bstcobj/1/
app.config(['$compileProvider', function ($compileProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|local|data|chrome-extension):/);
}]);
这解决了显示图像的问题。我帮了
ng-src 属性有问题。 我运行图片中本地主机上的项目显示正确。
<img width = "100%" ng-src = "{{item.poster}}">
但是如果我使用 nw.js 启动项目,则没有图片,只有文本值。 谁遇到过这个问题。告诉我怎么解决。
这是我重复的代码的全部代码
<div class="col-md-2 movie-con" style="padding:5px" ng-repeat="item in movie | filter:query">
<div class="col-md-12 img" style="padding:0;">
<img width="100%" ng-src="{{ item.poster }}">
</div>
<div class="col-md-12">
<span style="color:#AEAEAE;">{{ item.name }}</span>
</div>
</div>
您可以使用指令 "ng-if"。这是示例:
<div ng-app="myApp">
<div ng-controller="myCtrl">
<div ng-repeat="item in items" style="border: 1px solid blue; margin: 10px; display: inline-box;" >
<div ng-if="!item.url">
{{item.title}}
</div>
<div ng-if="item.url">
<img src="{{item.url}}" height=80 />
</div>
</div>
</div>
这是一个活生生的例子:http://jsfiddle.net/4bstcobj/1/
app.config(['$compileProvider', function ($compileProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|local|data|chrome-extension):/);
}]);
这解决了显示图像的问题。我帮了