Navin Chinnasamy Navin Chinnasamy - 6 months ago 29
AngularJS Question

Get angularjs controller of current html page

How can I get the controller of the current page that is displayed on device? I just want to add a class named as controller name of that page. So that I can customize that page dynamically.


Do like this :$rootScope) {
    $rootScope.$on('$routeChangeSuccess', function(ev,data) {   
       if (data.$route && data.$route.controller)
    $rootScope.controller = data.$route.controller;