0

If the user is on the create-projects page I want to add a CSS class to the 'logo' button and remove it if its not on that page this is what I have currently. Does anyone know a way of doing this please?

angular.module('')
    .config(function($stateProvider) {
        $stateProvider
            .state('create-project', {
                url: '/create-project',
                parent: 'layout',
                views: {
                    'content@': {
                        templateUrl: 'dashboard/views/projects/create.html',
                        controller: 'CreateProjectController'
                    },
                    'title@layout': {
                        template: 'Create a project'
                    },

                    'class@layout': {
                        template: 'className'
                    }
                }
            })
        ;
    });


<md-button class="md-icon-button logo" aria-label="Dashboard" ui-sref="projects">
    <md-icon class="icon-logo"></md-icon>
</md-button>
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
NoDachi
  • 874
  • 4
  • 10
  • 20
  • 1
    you have conditional handling. with ng-class. Check documentation here https://docs.angularjs.org/api/ng/directive/ngClass – Acewin Aug 22 '17 at 16:07
  • you can also use .run() function and check the route change using $stateChangeStart if url match then add class. – Ravi Kumar Aug 22 '17 at 16:39

0 Answers0