javascript - update a model in a ng-repeat inside another -


i having first ng-repeat looping on data , ng-repeat looping on other data . added ng-change in inner ng-repeat loops on data fill select element "options/values" , ng-change must listen changes in select element , calls function everytime value gets changed dose not happen .

here html code

                    <tr ng-repeat="memo in memos" class="no-animate">                         <td class="text-center">{{memo.memostatus | localize:'ar'}}</td>                         <td class="text-center">                             {{memo.memorequireddate | date: 'yyyy-mm-dd'}}                             <p ng-hide="memo.memorequireddate">----</p>                         </td>                         <td class="text-center">                             <select ng-model="newinfo.selectedconsultantindex" ng-change="updateconsultant(memo.caseid, newinfo.selectedconsultantindex)" class="form-control">                                 <option value="">-- المستشارين --</option>                                 <option ng-repeat="consultant in consultants track $index" value="{{$index}}">{{consultant.firstname}} {{consultant.lastname}}</option>                             </select>                         </td>                         <td class="text-center">{{memo.court[0].name}}</td>                         <td class="text-center">                             <p ng-repeat="defendant in memo.defendant">                                 {{defendant.user.firstname}} {{defendant.user.lastname}} - {{defendant.role[defendant.role.length - 1]}}                             </p>                         </td>                         <td class="text-center">                             <p ng-repeat="client in memo.client">                                 {{client.user.firstname}} {{client.user.lastname}} - {{client.role[client.role.length - 1]}}                             </p>                         </td>                         <td class="text-center">إختبارية</td>                         <td class="text-center">{{memo.casenumber}}</td>                     </tr> 

and here js code

 $scope.updateconsultant = function(){     console.log('hello world'); }  

you should try use ngoptions select : https://docs.angularjs.org/api/ng/directive/ngoptions


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -