ng-change无法正常工作

时间:2015-05-26 16:00:20

标签: javascript angularjs

我有2个选择下拉框,第二个选择下拉框的选项取决于第一个选择框。 (1st)选择框中的值来自DB,(1st)select的选项,传递id并在(2nd)选择框中获取与该id相关的选项。但是,每次调用ng-change时,它都会从(2nd)选择框中清除之前的选项值。有没有其他方法这样做?

<div class="col-md-4">
   <div>
   **(1st)**
      <select class="form-control"name="label_name"  ng-model="item.ProfessionalServicesDetail.label_name" name="state" required="" ng-change="fill_services(item.ProfessionalServicesDetail.label_name)">
            <option  ng-repeat="(key, value) in divisions" ng-selected="{{value == item.ProfessionalServicesDetail.label_name}}"  value="{{key}}">{{value}}</option>
      </select>
   </div>
   <div>
   **(2nd)** 
      <select name="service_name" class="form-control"  required="">
            <option value="{{item.ProfessionalServicesDetail.service_name}}">{{item.ProfessionalServicesDetail.service_name}}</option>  
            <option  ng-repeat="(key, value) in subcat"   value="{{key}}">{{value}}</option>
      </select>
    </div>
</div>

0 个答案:

没有答案