This is what I have so far:

This is simple drop down based login. What I want to do is to change the login bar to something else when person logs in, but I want current state to be unchanged.
(in this example I'd like the "This is home view" text to be displayed regardless of login state).
My current code structure:
<body ng-app="pmfApp">
<div>
<!--- login form and stuff.... ---->
</div>
<nav class="navbar">
<div class="container-fluid">
<div id="status-buttons" class="text-center">
<a ui-sref-active="active" ui-sref="home">Home</a>
<a ui-sref-active="active" ui-sref="about"> About</a>
</div>
</div>
</nav>
<div ui-view>
<!--- I have home state view triggered ---->
</div>
So if login goes successful I have something like this:
$auth.login(credentials).then(function(data) {
$state.go('???????', {});
});
It sounds like you want to set a flag in the $scope to track if the user is logged in. You could then use this with ng-if to show and hide the sections you want based on the users login status.
<div ng-if="!loggedInFlag">
<!--- login form and stuff.... ---->
</div>
<nav class="navbar" ng-if="loggedInFlag">
<div class="container-fluid">
<div id="status-buttons" class="text-center">
<a ui-sref-active="active" ui-sref="home">Home</a>
<a ui-sref-active="active" ui-sref="about"> About</a>
</div>
</div>
</nav>
<div ui-view>
<!--- I have home state view triggered ---->
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With