【发布时间】:2015-06-05 19:41:59
【问题描述】:
我正在创建一个 Web 应用程序,我在其中使用 bootstrap selectpicker 进行选择。但我正在使用 angularjs 填充选择选择器。我有 2 个选择,其中一个内容根据第一个选择值填充,无需重新加载。 . 我可以在没有 selectpicker 的情况下完美地工作,而在使用 selectpicker 时它不起作用.. 我的代码是
<div class="form-group" data-ng-controller="MARK_ENTRY_CONTROLLER">
<div class="row">
<div class="col-md-6 " style="margin-top: 7px;">
<label>Select Class</label>
</div>
<div class="col-md-6 text-center">
<select class="form-control" title="Select Class"
name="fromClass" ng-change="EXAM_LIST_JSON(fromClass)"
ng-model="fromClass"
ng-options="fromClass.id as fromClass.course + ' ' + fromClass.section for fromClass in ALL_CLASS">
</select>
</div>
</div>
<div class="row" style="height: 10px"></div>
<div class="row">
<div class="col-md-6 " style="margin-top: 7px;">
<label>Select Examination</label>
</div>
<div class="col-md-6 text-center" >
<select class="form-control" name="examination"
ng-change="SUBJECT_LIST_IN_EXAM_JSON()"
ng-model="examination"
ng-options="examination.id as examination.name for examination in EXAM_LIST"></select>
</div>
</div>
控制器是
<script>
function MARK_ENTRY_CONTROLLER($scope, $http) {
$http.get("<%=request.getContextPath()%>/ALL_CLASS_JSON?AAdvisorId=${uid}").success(function(response) {
$scope.ALL_CLASS = response;
$scope.EXAM_LIST_JSON = function(id){
$http.get("<%=request.getContextPath()%>/EXAM_LIST_JSON?fromClass="+id)
.success(function(response) {
$scope.EXAM_LIST = response;
$scope.$apply();
});
}
});
}
</script>
在控制器中,数据列表是从使用 json 格式的 json 文件中获取的。 请帮帮我..
【问题讨论】:
标签: json angularjs bootstrap-select