I want when refresh the page show the tab active that is previosly selected, not the default one, using angular Js?

I am new in angular Js. I have a page with tabs, i want when i selected the tab and refresh the page then same tab will be shown, not the default one. how can I do this. Thanks in advance.

    angular.module('TabsApp', [])
    .controller('TabsCtrl', ['$scope', function ($scope) {
        $scope.tabs = [{
                title: 'One',
                url: 'one.tpl.html'
            }, {
                title: 'Two',
                url: 'two.tpl.html'
            }, {
                title: 'Three',
                url: 'three.tpl.html'
        }];

        $scope.currentTab = 'two.tpl.html';

        $scope.onClickTab = function (tab) {
            $scope.currentTab = tab.url;

        }

        $scope.isActiveTab = function(tabUrl) {
            return tabUrl == $scope.currentTab;
        }
    }]);

Answers


Try using cookies to keep selected tab and retrieve it on page load


Need Your Help

how to print without url and datetime by javascript

javascript jquery printing

I want to print the div tag content by javascript by using the following code.

How do I add a Font Awesome icon to input field?

html css html5 css3 font-awesome

How do I use the search icon included in Font Awesome for input? I have a search feature on my site (based on PHPmotion), that I want to use for the search.