Tôi mới sử dụng Ionic. Tôi đang sử dụng Ionic Framework (1.3.20), góc JS, Cordova 5.0.0Vấn đề với ứng dụng Android Hybid để hiển thị hình ảnh từ xa với khung Ionic?
tập tin Template đang browse.html:
<div class="col-50"><img ng-src="{{availableImages[currentImage].src}}" /></div>
app.js mã:
.state('app.browse', {
url: "/browse",
views: {
'menuContent': {
templateUrl: "templates/browse.html",
controller: 'Ctrl'
}
}
})
controller.js mã
.controller('Ctrl',function($scope) {
$scope.currentImage = 0;
$scope.availableImages = [
{
src: "http://lorempixel.com/160/160/people/3"
}
];
console.log("reading image in controller !!!");
})
chi tiết Tiêu đề:
Request URL:http://lorempixel.com/160/160/people/3
Request Method:GET
Status Code:404 Not Found (from cache)
Response Headers
Client-Via:shouldInterceptRequest
Request Headers
Provisional headers are shown
Accept:image/webp,*/*;q=0.8
User-Agent:Mozilla/5.0 (Linux; Android 5.0.2; XT1033 Build/LXB22.46-28; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/42.0.2311.129 Mobile Safari/537.36
Config.xml file:
<access origin="*"/>
Lỗi trên console:
GET http://lorempixel.com/160/160/people/3 404 (Not Found)
tôi xác nhận url http://lorempixel.com/160/160/people/3 đang hiển thị hình ảnh trong trình duyệt trên điện thoại di động của tôi. nhưng hình ảnh không xuất hiện trên ứng dụng.
Điều này thật kỳ lạ. Tôi đã thử nó trên Codepen.io và nó hoạt động. Ứng dụng của bạn có quyền truy cập Internet không? – Keval
có thêm các quyền này trong AndroidManifest.xml –
OK. Thử cài đặt plugin này - https://github.com/apache/cordova-plugin-whitelist và thêm ' ' vào ** config.xml ** của bạn . –
Keval