1
私のionicアプリケーションはキャッシュにjsdataデータストアを使用しますhttp://www.js-data.io/docs/home 。
私はイオンリフレッシャー指令を使用してアプリでリフレッシュ機能を実装しようとしています。
jsdataによるイオンリフレッシュは機能しないようです
doRefreshはGet Callを作成していないようです。
[Pull]をクリックして更新すると、以下のコードのすべてのconsole.logメッセージが実行されます。
しかし、ネットワークのタブをチェックすると、Getコールがまったく行われません。
データは更新されず、エラーも発生しません。
なぜこれが起こっているのか、私が間違っているのか分かりません。
マイコード:
HTML:
<ion-refresher
pulling-text="Pull to refresh..."
on-refresh="doRefresh()">
</ion-refresher>
コントローラー:あなたのdoRefresh
メソッド内
.controller('ProfileInfo', function($scope, Profile) {
$scope.load = function() {
$scope.error = undefined;
Profile.findAll().then(function(response) {
$scope.Profile = response[0];
}).catch(function(err) {
$scope.error = err;
});
};
$scope.load();
$scope.doRefresh = function() {
console.log("hi")
$scope.error = undefined;
$scope.Profile = [];
Profile.findAll().then(function(response) {
console.log($scope.Profile)
$scope.Profile = response[0];
console.log($scope.Profile)
console.log("Done")
}).catch(function(err) {
console.log("err", err)
$scope.error = err;
}).finally(function(){
console.log("in finally")
$scope.$broadcast('scroll.refreshComplete');
});
};
});
それがうまくいった!ありがとう!! :) –