Sử dụng cordovaToast plugin cho feature.Here đây là ví dụ cho thấy pdf tải về tiến bộ
html
<ion-view >
<div class="bar bar-subheader bar-positive" style="padding:0px;height: 8px;" >
<progress id="progressbar" max="100" value="{{ downloadProgress }}" class="progress"> </progress>
</div>
<ion-content>
</ion-content>
</ion-view>
css
.progress {
margin: 0 px;
height: 8 px;
background - color: #F1292B!important;
border - radius: 2 px;
box - shadow: 0 2 px 5 px rgba(0, 0, 0, 0.25) inset;
}
js
if (window.cordova) {
var url = '{{base_url}}/pdf_download/' + id;
// Android
var targetPath = 'file:///storage/sdcard0/' + 'fpl_' + id + '.pdf';
var trustHosts = true;
var options = {};
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
$cordovaToast
.show('File downloaded successfully..', 'short', 'center')
.then(function() {
// success
}, function() {
// error
});
console.log(result);
}, function() {
var alertPopup = $ionicPopup.alert({
title: 'No internet access',
buttons: [{
text: 'OK',
type: 'button-assertive'
}]
});
alertPopup.then(function() {});
}, function(progress) {
var dnldpgs = progress.loaded.toString().substring(0, 2);
$scope.downloadProgress = parseInt(dnldpgs);
});
}
Nếu bạn có bất kỳ doubt.Please cho tôi know.Thanks.
Bạn có nhận được giải pháp nào cho điều này không? –
Chưa, yêu cầu cộng đồng ion tốt hơn nếu họ cung cấp bất kỳ giải pháp nào. – sonu
Tìm câu trả lời cho cùng một câu hỏi này. Html có được cung cấp cho thuộc tính 'text' của phương thức' configure' của 'cordova-plugin-background-mode' có hoạt động không? – davejoem