javascript - ui select 2 selected value doesnt change - angularjs -
i m using ui.select2 dropdowns
scenario have ajax call return drop down values
document.dropdowndocstatuses = [ { key: 0, value: 'all active (' + response.totaldocuments + ')' }, { key: 1, value: 'draft (' + response.draft + ')' } ];
in html have
<select ui-select2 class="form-control font-12px input-style3 " ng-model="document.dropdowndocstatus" ng-change="document.filterdocuments()"> <option ng-repeat="documents in document.dropdowndocstatuses" value="{{documents.key}}">({{documents.value}})</option> </select>
user have selected value
issue when update value of dropdown using
_document.dropdowndocstatuses[_document.dropdowndocstatus].value++; _document.dropdowndocstatuses[1].value++;
valuge gets updated doesnt change selected value text whereas if click on dropdown changed value in dropdown
can guide me how can fix issue, appreciated
i have come across same issues yours, , root cause ng-model field, should not use "options" field store ng-model, try create field ng-model, , able select value.
e.g.
document.dropdowndocstatuses = [ { key: 0, value: 'all active (' + response.totaldocuments + ')' }, { key: 1, value: 'draft (' + response.draft + ')' } ]; document.selecteddocstatus = [];
and in html:
<select ui-select2 class="form-control font-12px input-style3 " ng-model="document.selecteddocstatus" ng-change="document.filterdocuments()"> <option ng-repeat="documents in document.dropdowndocstatuses" value="{{documents.key}}">({{documents.value}})</option> </select>
then should able select value successfully.
Comments
Post a Comment