I created the following:
$scope.option.questionOrderBy = [
{ label: 'PId', key: ['problemId', 'QuestionId'] },
{ label: 'QId', key: 'questionId' },
{ label: 'Modified By', key: 'modifiedBy' },
{ label: 'Modified Date', key: 'modified' },
{ label: 'Status', key: 'questionStatusId' },
{ label: 'Title', key: 'title' }
];
and use this here:
<select
data-ng-model="option.selectedQuestionSort"
data-ng-options="o.label for o in option.questionOrderBy">
<option style="display: none" value="">Select Sort Order</option>
</select>
and in my HTML:
data-ng-repeat="row in grid.data | orderBy:option.selectedQuestion.key">
This works but I would like to use local storage to remember the value of the sort.
When I try to store the "option.selectedQuestionSort" this is an array !
Is there a way I could change the above so that I could store a value in localstorage instead of an array for option.selectedQuestionSort. Then when my code starts I could get the value and have the select show the right selection?
Note here's my code to store into local storage:
$scope.$watch('option.selectedQuestionSort', function () {
if ($scope.option.selectedQuestionSort != null ) {
localStorageService.add('selectedQuestionSort', $scope.option.selectedQuestionSort);
}
})
The problem is $scope.option.selectedQuestionSort is an array so I don't think I can store that correctly.