javascript - Error: ngModel: Non-Assignable Expression -
i have code generates drop down list dynamically. want set selected value using ng-repeat, using function in ng-model getting
error: [ngmodel:nonassign] expression 'item.blockname = getcurrentcomboboxvalue(item.blockname.id, blocknameoptions)' non-assignable. element: <select class="form-control input-sm" ng-model="item.blockname = getcurrentcomboboxvalue(item.blockname.id, blocknameoptions)" name="blockname" ng-options="choice.id choice.value choice in blocknameoptions"> html
<div ng-repeat="item in modulesdata.blocks track item.id"> <select class="form-control input-sm" ng-model="item.blockname = getcurrentcomboboxvalue(item.blockname.id, blocknameoptions)" name="blockname" ng-options="choice.id choice.value choice in blocknameoptions"> </select> </div> controller
$scope.getcurrentcomboboxvalue = function (id, availabledata) { var result = _.where(availabledata, { 'id': id }); return result[0]; }
getcurrentcomboboxvalue(blocknameoptions) not valid on left-hand side of =. ngmodel requires thing on left-hand side assignable.
Comments
Post a Comment