AODController.js 1.51 KB
AIA.controller("AODController", ["$scope", "$rootScope", "pages", "$log","$location",
function ($scope, $rootScope, pages, log, $location) {
  

    $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");
    }
 

    $scope.$on('$viewContentLoaded', function (event) {

        if ($rootScope.refreshcheck == null) {
            $location.path('/');
        }

        // 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.showTabButton = true;
        $scope.IsVisible = function () {
            $scope.scroll();

        }

     //   $rootScope.currentActiveModuleTitle = pages[10].name;

        //set the local storage

        var curtab = $rootScope.getLocalStorageValue("currentAODTabView");
        if (curtab == 2) {
            $scope.setActiveTab(2);
        }
        else {
            $scope.setActiveTab(1);
        }

    });

}]



);