AIA.controller("AODController", ["$scope", "$rootScope", "pages", "$log","$location", function ($scope, $rootScope, pages, log, $location) { //$scope.showme = true; //$scope.IsVisible = function () { // $scope.scroll(); //} $scope.setActiveTab = function (tabToSet) { $scope.activeTab = tabToSet; localStorage.setItem("currentAODTabView", $scope.activeTab); }; $scope.scroll = function () { // $window.scrollTo(0, 0); $("html,body").scrollTop(0); //alert("scroll"); } //$rootScope.currentActiveModuleTitle = pages[10].name; $scope.$on('$viewContentLoaded', function (event) { // code that will be executed ... // every time this view is loaded //get current path var currentURL = $location.path(); var selectedModuleName = ''; //set module title angular.forEach($rootScope.userModules, function (value, key) { if (value.slug === currentURL.replace('/', '')) { selectedModuleName = value.name; } $rootScope.currentActiveModuleTitle = selectedModuleName; }) $scope.showme = true; $scope.IsVisible = function () { $scope.scroll(); } // $rootScope.currentActiveModuleTitle = pages[10].name; //set the local storage var curtab = localStorage.getItem("currentAODTabView"); if (curtab == 2) { $scope.setActiveTab(2); } else { $scope.setActiveTab(1); } }); }] );