如何在angularJS中添加更多复选框下拉菜单

时间:2016-07-07 07:12:34

标签: javascript php html arrays angularjs

以下是我的代码,

<div ng-dropdown-multiselect options="master_days_name" selected-model="selected_days_name" ></div>

<select name="end_time" ng-model="PostJobData.facility_hours.end_time" data-bvalidator="required" class="form-control"  data-bvalidator-msg="Required">
    <option value="">End Time</option>
    <option ng-repeat = "val in time_array"  value="{{val}}">{{val}}</option>                
</select>

<a href="javascript:void(0);" class="" ng-click="addMoreFacilityHours()">  Add More</a>

当前结果

enter image description here

现在我想,如果用户点击添加更多,那么这个下拉列表会重复,周二,周三,周六,周日(取消选中值) 添加更多功能

<div class="row dobBlock" ng-repeat="(hours_key,hours_value) in PostJobData.facility_hours">
        <div ng-dropdown-multiselect options="master_days_name" selected-model="selected_days_name" ></div>
</div>

Js代码

$scope.PostJobData.facility_hours = [];

$scope.addMoreFacilityHours = function()
{
    var temp = {'days':[],'start_time':'', 'end_time':'' };
    $scope.PostJobData.facility_hours.push(temp);
    console.log($scope.PostJobData.facility_hours);
}

但是这个给出相同的数组克隆意味着我只想在第二个选择框中显示取消选中该选项怎么做?

结果

enter image description here

0 个答案:

没有答案