angularjs - Angular JS Action on ng-change the select dropdown -
i have simple table 3 rows , 2 values each row - date , state:
<tbody>    <tr>       <td>red</td>         <td class="lastmodified">{{item.reddate}}</td>         <td class="status">              <select id ="red" class="form-control" ng-change="update();" ng-model="item.redstatus">               <option value="" disabled="" selected="" class="ng-binding">please select value</option>               <option ng-selected="step.value === item.redstatus"  ng-repeat="(key, step) in steps">{{ step.title }}</option>             </select>        </td>    </tr>    <tr>green</tr>    <tr>      ....    </tr>                     </tbody>   so, simple date , status values red, green , blue. 1 in dropdown - status, second - output date.
on change select value - need update date today's date.
 `$scope.item.reddate = new date();`   is possible have 1 function ng-change="change();" can't send ng-change id...
special samir das find solution ng-change="update(id);":
<select id ="red" class="form-control" ng-change="update(id);" ng-model="item.redstatus">           <option value="" disabled="" selected="" class="ng-binding">please select value</option>           <option ng-selected="step.value === item.redstatus"  ng-repeat="(key, step) in steps">{{ step.title }}</option>  </select>   here controller:
$scope.update = function(id){     id = event.target.id;     $scope.item[id+'date'] = new date();  };      
Comments
Post a Comment