So, I'm using ui-router and a index.html as my layout, inside them I have this div which will append others pages, for example:
I have this HTML, which is my layout.html:
<html ng-app="myApp">
<head>
<title> My layout.html </title>
</head>
<body>
<nav>
I have this NAVBAR
</nav>
<div ui-view></div>
</body>
</html>
So, if I access the page 'posts', the Angular will append the code inside the posts.html in the <div ui-view></div>
Nothing unusual, right?
The question is.. i have a 404.html template file, which I don't want show the navbar. Is possible take off or hide the navbar if the page is the 404.html?
I would create a controller for the navigation section.
.controller('NavCtrl', function($scope, $state) {
$scope.$state = $state;
})
Then hide the navigation when the current state is 404:
<nav ng-controller="NavCtrl" ng-hide="$state.current.name == '404'">
I have this NAVBAR
</nav>
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