i'm trying make simple log in system in ionic. when type in credentials , hit log in should take me settings screen. so, doesn't update header; still says account - should settings.
settings view:
<ion-view view-title = "settings"> <ion-nav-buttons side="primary"> <button class="button button-full button-assertive" style = "margin-top: 0px;" ng-click = "signoff()"> log off </button> </ion-nav-buttons> <ion-content class="has-header padding"> ... ... ... </ion-content> </ion-view>
account view:
<ion-view view-title="account"> <ion-nav-buttons side="primary"> <button class="button button-full button-assertive" style = "margin-top: 0px;" ng-click = "signoff()"> log off </button> </ion-nav-buttons> <ion-content class = "padding"> <div class="list"> <label class="item item-input"> <span class="input-label">username</span> <input type="text" ng-model = "username"> </label> <label class="item item-input"> <span class="input-label">password</span> <input type="password" ng-model = "password"> </label> <button style = "margin: 10px"; class="button button-positive"; ng-click = "login(username, password)"> log in </button> <button style = "margin: 10px"; class="button button-positive"; ng-click = "createaccount(username, password)"> create account </button> </div> </ion-content> </ion-view>
tabs.html:
<ion-tabs class="tabs-icon-top tabs-color-active-positive"> <!-- dashboard tab --> <ion-tab title="status" icon-off="ion-ios-pulse" icon-on="ion-ios-pulse-strong" href="#/tab/dash"> <ion-nav-view name="tab-dash"></ion-nav-view> </ion-tab> <!-- chats tab --> <ion-tab title="chats" icon-off="ion-ios-chatboxes-outline" icon-on="ion-ios-chatboxes" href="#/tab/chats"> <ion-nav-view name="tab-chats"></ion-nav-view> </ion-tab> <!-- account tab --> <ion-tab title="account" icon-off="ion-ios-gear-outline" icon-on="ion-ios-gear" href="#/tab/account"> <ion-nav-view name="tab-account"></ion-nav-view> </ion-tab> <ion-tab title="settings" hidden="true"> <ion-nav-view name="tab-settings"></ion-nav-view> </ion-tab> </ion-tabs>
login function:
$scope.login = function(username, password) { console.log(username); console.log(password); $rootscope.ref.authwithpassword({ email : username, password : password }, function(error, authdata) { if (error) { console.log("login failed!", error); } else { console.log("authenticated payload:", authdata); $rootscope.isloggedin = true; $state.go('tab.settings'); // $window.location.href = "#/tab/settings"; } }); };
i've tried $window.location.href instead of $state.go , i've tried use ion-nav-title inside of ion-view both still yields same result...
any ideas?
thanks in advanced!
edit: looks uses account controller instead of settings controller.
Comments
Post a Comment