简体   繁体   中英

already selected item should come selected at next time when I open the same page

I have used ng-options directive in my ftl. I select an option from drop down but when next time I open the same page, earlier selected item doesn't come selected. Please solve my problem.

<script>
    campusApp.controller('personalDetCtrl', function($scope, $http) {
        $http.get("OnlineRecruitmentApplication.action?formInstruction=ngCall")
           .success(function (response) {
               $scope.categories = response;
           });
</script>
<div class="control-groups">
    <label class="control-label text-danger">Category/वर्ग </label>
    <div class="controls">
        <select ng-model="appForm.category"
                ng-options="category.text for category in categories"
                ng-blur="addForm('${userApplicationId}')">
            <option value="">{{appForm.category.name}}</option>
        </select>
    </div>
</div>

Data type of appForm.category and category.text for category in categories was different. Now we are using same data type at server side and default option is coming selected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM