Angular js open SelectBox in editing form

Viewed 263

I have a object which is coming from server through ajax call when task is selected by id

created_by:null

created_on:null

description:"abc"

group_id:1

groupmasterModel:Object

         created_by:1
         created_on:1496039260000
         description:"Onboarding & Offer Processing"
         group_name:"Onboarding & Offer Processing"
         id:1
         updated_by:1
         updated_on:1496039266000
         id:15

  name:"gg"

role_id:1

rolemodel:Object

     created_by:1
     created_on:1493791080000
     id:1
     role:"System"
     updated_by:1
     updated_on:1493791086000

sub_task_type1:"mail"

sub_task_type2:"upload"

updated_by:null

updated_on:1496060158000

and in html i have dropdown list

   <div class="col-sm-8 col-xs-12">   
            <select id="roleData"  ng-model="task.rolemodel.role"  class="form-control">
                <option value="">-- Select Role --</option>
                <option data-ng-repeat="roleData in roleDatas" value="{{roleData.id}}">{{roleData.role}}</option> 
            </select>
    </div>
 </div>


 $scope.populateValues=function(){
                        alert($scope.task.name);
             $http({method: 'GET', url: 'getTaskDetailsById' , params:{taskId:$scope.task.name}}).
             success(function(data, status, headers, config) {
                    console.log(data);
                    $scope.task=angular.copy(data);             
                 }).
                error(function(data, status, headers, config) {
                    alert("Error Occured");
                }); 
             };

now my question is that i need to edit the form as well as saveafter editing....So i need to open the form in edit form. My problem is that i need to edit the dropdown role _id respective of its name from rolemodel object .its not selecting just showing blank dropdown

any solution as fast

2 Answers
Related