5

有谁知道如何使用 Ionic(http://ionicframework.com/docs/)显示本地图像,打包在 Cordova 容器中?

当应用程序在设备上运行时,我目前收到此错误:

GET unsafe:local:///img/thumbs/myImage.jpg 未处理协议

我的 Cordova 应用程序是使用 ionic 框架为 BlackBerry 10 和 Android 构建的。该应用程序使用以下模板显示封装在 Cordova 应用程序本身内的图像:

<img ng-src="img/thumbs/{{img.path}}" ng-click="fooBar(img)"/>

为什么会出现这个错误?

4

3 回答 3

2

我发现这是有关 BlackBerry 10 支持的 ionic 框架的当前限制。我在这里记录了一个错误:http: //github.com/driftyco/ionic/issues/1066

为了解决这个问题,我已经手动编辑了 ionic 库以包含对本地协议的支持。

于 2014-04-08T23:03:56.637 回答
1

角度问题

替换 ionic.bundle.js 中的以下行

var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
     imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;

var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file|local):/,
     imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob|local):|data:image\/)/;
于 2015-04-02T16:36:22.743 回答
0

我刚刚向 Angular 提出了请求,因为它是 Angular 的限制,而不是 Ionic 框架的限制。您可以在此处查看拉取请求:https ://github.com/angular/angular.js/pull/8787

于 2014-08-26T23:03:08.363 回答