Ionic 1.3 hides NavBar when caching is disabled -


i started working ionic , ran issue data not being updated on re-entering views. on finding more ionic, realized can disable caching view , ionic forced recreate view each time.

however, when use $state.go('statename',{},{reload: true}) , ionic caching disabled, issue.

my controller called twice view , navbar disappears.

the same issue open @ ionic here. there has been discussion issue here on ionic forum. however, proposed solution of marking hide-nav-bar="false" not work me.

with solution of

$scope.$on('$ionicview.enter', function(e) {       $ionicnavbardelegate.showbar(true);     }); 

my navbar becomes visible no buttons, , also, controller being called twice.

since should very common scenario app not need view caching, please share appropriate workaround figured out past this?

thanks help!

don't use {reload: true} in $state.go method update data in view because causing controller called twice. since ionic caches controller, in order update data every time redirect view can use $ionicview lifecycle hooks namely beforeenter, enter, loaded etc.

.controller('appcontroller', function ($scope) {    $scope.$on('$ionicview.beforeenter', function () {      // fetch data here updated every time redirect view    }) }); 

this scalable approach fetching data in controllers

more details lifecycle methods can found here: http://ionicframework.com/docs/api/directive/ionview/


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -