首页 > 代码库 > angularJs 处理下拉列表(select option)

angularJs 处理下拉列表(select option)

<select ui-select2="{allowClear: true }" ng-model="orderTreatInfo.performDeptId" id="treatPerformDeptId">
    <option value=""></option>
    <option ng-repeat="performDept in performDeptList" value="{{::performDept.deptCode}}">
        {{::performDept.deptName}}
    </option>
</select>

performDeptList 是下拉列表要显示的内容,是一个数组用来ng-repeat遍历的

performDept 是 performDeptList 的每一项

value="http://www.mamicode.com/{{::performDept.deptCode}}" 如果选中这一项value的值就会被赋值给 $scope.orderTreatInfo.performDeptId

{{::performDetp.deptName}}是用来显示在select中的内容 选择这个 则实际赋值的则是其option标签中的value值

angularJs 处理下拉列表(select option)