hi all,
i have a piece of code as follows:
this.isStockCountDue = function(reminderDay){
var deferred = $q.defer();
storageService.all(storageService.STOCK_COUNT)
.then(function (results) {
var now = new Date();
var currentWeekDateInfo = utility.getWeekRangeByDate(now,
reminderDay);
currentWeekDateInfo =
getCorrectWeeklyDateInfo(currentWeekDateInfo);
var today = $filter('date')(now, 'yyyy-MM-dd');
//get stock-counts within current and week date range
var stockCountsWithInRange = results.filter(function (stockCount) {
return (stockCount.isComplete === 1) &&
(!reminderFactory.isWeeklyReminderDue(stockCount,
'countDate', currentWeekDateInfo.reminderDate));
});
var isStockCountReminderDue = (today >=
$filter('date')(currentWeekDateInfo.reminderDate, 'yyyy-MM-dd')) &&
(stockCountsWithInRange.length === 0);
deferred.resolve(isStockCountReminderDue);
})
.catch(function(reason){
deferred.resolve(false);
});
return deferred.promise;
};
this is the piece of code that calculates if stock count event reminder is
due, then i resolve it in resolve block as follows:
$stateProvider.state('home', {
parent: 'root.index',
templateUrl: 'views/home/index.html',
resolve: {
appConfig: function(appConfigService){
return appConfigService.getCurrentAppConfig();
},
isStockCountReminderDue: function(appConfigService, appConfig){
if(typeof appConfig !== 'undefined'){
return appConfigService.isStockCountDue(appConfig.reminderDay);
}
return false;
}
},
controller: function(appConfig, $state, $scope,
isStockCountReminderDue) {
if (typeof appConfig === 'undefined') {
$state.go('appConfigWelcome');
}else{
$scope.facility = appConfig.appFacility.name;
$scope.isStockCountReminderDue = isStockCountReminderDue;
}
}
});
this works fine on web browsers and chrome app version but when i convert
this into cordova chrome mobile app using cca build tool, after completing
stock count it still shows the reminder until i navigate away from the home
page and come back to the home page, this time the reminder goes away.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.