angularjs - ionic $state.go redirect does not load ui correctly until click -
i using ionic firebase, , trying redirect upon login home page. $state.go redirect work, have hidden tab called 'profile', not show until user authenticated. tab remains hidden on $state.go redirect, , doesn't show until click on 'home' tab again. how load load ui on redirect?
html:
tabs html:
<ion-tabs class="tabs-icon-top tabs-color-active-positive" ng-controller="loginctrl"> <!-- login tab --> <ion-tab title="login" icon-off="ion-locked" icon-on="ion-locked" href="#/tab/login"> <ion-nav-view name="tab-login"></ion-nav-view> </ion-tab> <!-- dashboard tab --> <ion-tab title="new post" icon-off="ion-compose" icon-on="ion-compose" href="#/tab/new"> <ion-nav-view name="tab-new"></ion-nav-view> </ion-tab> <!-- chats tab --> <ion-tab title="home" icon-off="ion-ios-home" icon-on="ion-ios-home" href="#/tab/home"> <ion-nav-view name="tab-home"></ion-nav-view> </ion-tab> <!-- account tab --> <ion-tab class="{{hiddenprofiletab()}}" title="profile" icon-off="ion-person" icon-on="ion-person" href="#/tab/profile"> <ion-nav-view name="tab-profile"></ion-nav-view> </ion-tab> </ion-tabs>
login controller
.controller('loginctrl', ['$scope', '$rootscope', '$state', '$location', function($scope, $rootscope, $state, $location) { $scope.hiddenprofiletab = function(){ // return "ng-hide"; if ($rootscope.currentuser){ return "ng-show"; } else { return "ng-hide"; } } //do things // $location.path('tab.home') // $state.go('tab.home') // $state.go('tab.home'), {}, { reload: true } $state.go('tab.home',{},{location:'replace'}); }; }])
to reiterate problem, profile tab remains hidden on $state.go redirect 'home' page, until 'home' page tab clicked.
any ideas how load ui on redirect?
use ng-show
instead of using class attribute {{}}
interpolation.
<ion-tab ng-show="currentuser" title="profile" icon-off="ion-person" icon-on="ion-person" href="#/tab/profile"> <ion-nav-view name="tab-profile"></ion-nav-view> </ion-tab>
Comments
Post a Comment