Hey there! I'm looking to switch up the color of my nav-bar
every time a page loads. So, I gave this a shot in menu.html:
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="{{headerClass}}">
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="side-menu21"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-dark">
<div class="title">Menu</div>
</ion-header-bar>
<ion-content padding="false" class="side-menu-left has-header">
<ion-list>
<ion-item ui-sref="menu.home" menu-close="" class="item-icon-left"><i class="icon ion-home assertive"></i>Persée</ion-item>
<ion-item ui-sref="menu.offreSFR" menu-close="" class="item-icon-left"><i class="icon ion-ios-cart royal"></i>Offres SFR</ion-item>
<ion-item ui-sref="menu.mediatheque" menu-close="" class="item-icon-left"><i class="icon ion-ios-book energized"></i>Mediatheque</ion-item>
<ion-item ui-sref="menu.reporting" menu-close="" class="item-icon-left"><i class="icon ion-stats-bars balanced"></i>Reporting</ion-item>
<ion-item ui-sref="menu.FAQ" menu-close="" class="item-icon-left"><i class="icon ion-help calm"></i>FAQ</ion-item>
<ion-item ui-sref="connexion" menu-close="" class="item-icon-left"><i class="icon ion-log-out"></i>Se deconnecter</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
And then in controller.js:
angular.module('app.controllers', [])
.controller('homeCtrl', function($rootScope, $scope) {
$rootScope.headerClass = 'bar-assertive';
})
.controller('reportingCtrl', function($rootScope, $scope) {
$rootScope.headerClass = 'bar-balanced';
})
.controller('mediathequeCtrl', function($rootScope, $scope) {
$rootScope.headerClass = 'bar-energized';
})
.controller('offreSFRCtrl', function($rootScope, $scope) {
$rootScope.headerClass = 'bar-royal';
})
.controller('FAQCtrl', function($rootScope, $scope) {
$rootScope.headerClass = 'bar-calm';
})
.controller('connexionCtrl', function($rootScope, $scope) {
})
Appreciate any help!