I have a tabset that can be sorted, and it works as expected. However, I would like the user's tab order to be saved and not lost when they refresh the page.
<uib-tabset ui-sortable="sortableOptions" class="tab-container" my-restrict access="staff-businessDeveloper">
<uib-tab ng-controller="FirstCtrl" >
<tab-heading>
<i class="icon icon-user-following "></i> Dealers
</tab-heading>
<div class="panel-body table-responsive no-padding">
<table class="table table-striped table-responsive">
Some Stuff
</table>
</div>
</uib-tab>
<uib-tab ng-controller="SecondTabCtrl" >
<tab-heading>
<i class="icon icon-user-following "></i> Dealers2
</tab-heading>
<div class="panel-body table-responsive no-padding">
<table class="table table-striped table-responsive">
Some Stuff
</table>
</div>
</uib-tab>
</uib-tabset>
Here is the logic for sortable tabs in the controller:
$scope.sortableOptions = {
axis: 'x',
containment : "parent",
cursor : "move",
tolerance : "pointer",
start: function(e, ui) {
},
update: function(e, ui) {
$localStorage.tabOrder[$localStorage.me.id] = angular.element(this).sortable('toArray');
}
};
I am saving the tab order in $localStorage. How can I load it back?