Reputation: 713
Is there a way to show a div if view is a certain route. I have a universal header and footer but there is one thing on the header I don't want to show on my / route.
<body>
<header>
<section ng-if=""></section>
</header>
<div ng-view class="view">
<footer></footer>
</body>
Upvotes: 1
Views: 2738
Reputation: 5729
You could leverage $routeChangeSuccess. Something like this should work (not tested):
app.run(function($rootScope, $location) {
$rootScope.$on('$routeChangeSuccess', function() {
$rootScope.showSection = $location.path() !== "/";
});
});
and then...
<body>
<header>
<section ng-if="showSection"></section>
</header>
<div ng-view class="view">
<footer></footer>
</body>
Upvotes: 2