I'm a newbie to Ionic application.
I have created an app where certain template info is stored in SQLite DB and the saved data need to be displayed on Home page.
The problem that I am facing is the data on the Home page is not populated immediately, instead I need to refresh the page for the data to be displayed.
My code is as below:
Home.html Page:
<div class="col board" ng-repeat="template in template_info">
<div class="card">
<div class="item item-text-wrap bg5">
<div class="message">{{template.template.message}}</div>
<div class="icons">
<div class="mess-icon"><i class="icon ion-edit"></i> </ion-item></div>
</div>
</div>
</div>
</div>
HomePage Controller:
.controller('HomeCtrl', function($scope,$localstorage) {
$scope.template_info = $localstorage.getObject('Templates');
})
SaveTemplate Controller:
.controller('SaveTempCtrl', function($scope,$localstorage,$dba) {
$scope.saveTemplate = function(template) {
$dba.createTemplate($scope.template);
$scope.template_info = $dba.getTemplate();
$localstorage.setObject('Templates', $scope.template_info);
$location.path('/myapp/home');
}
})
Please provide help or advice so that I can display the saved data immediately on the Home Page without the need to refresh the Home Page.
Any help is appreciated, Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire