css - 使用bootstrap-multiselect.min.js的多选下拉列表未显示列表

标签 css angularjs twitter-bootstrap

打开表头时,多选下拉列表,下拉列表没有任何值。下面是代码,请建议添加任何引导类..我需要使用angularjs在此下拉值上应用过滤器



var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
	$('#filterName').multiselect();
   $http.get("http://www.w3schools.com/angular/customers_mysql.php")
   .then(function (response) {
		$scope.names = response.data.records;
   });
});

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css" />
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.min.js"></script>

<div ng-app="myApp" ng-controller="customersCtrl">
 
<table class="table table-stripped">
<thead>
	<tr>
		<th>
			<select id="filterName" multiple="multiple">
				<option ng-repeat="x in names">{{ x.Name }}</option>
			</select>
		</th>
		<th></th>
	</tr>
</thead>
<tbody>
  <tr ng-repeat="x in names">
    <td>{{ x.Name }}</td>
    <td>{{ x.Country }}</td>
  </tr>
  </tbody>
</table>
 
</div>

最佳答案

您必须延迟执行multiselect()

var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
  $http.get("http://www.w3schools.com/angular/customers_mysql.php")
    .then(function(response) {
      $scope.names = response.data.records;
    });
});

setTimeout(function() { 
  $('#filterName').multiselect();
}, 300);

关于css - 使用bootstrap-multiselect.min.js的多选下拉列表未显示列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37541402/

相关文章:

javascript - AngularJS 错误 : Cross origin requests are only supported for protocol schemes: http, 数据,chrome-extension,https

javascript - 如何从 Bootstrap 日期时间选择器中删除 AM/PM

php - 从 MySQL 转换为 MySQLi 面向对象

javascript - 使用 jQuery 动态更改元素高度

html - 使用 :before and :after properties 将右侧图像与背景颜色叠加

css - 为移动设备显示不同的 DIV

javascript - Angular JS 脚本适用于 Firefox,不适用于 IE 11

javascript - firebase 对象大小 : how to ignore properties with $?

html - 通过使用 javascript 在类中添加一个词来单击按钮时为菜单添加/删除 [toggle]

css - Twitter Bootstrap 搞砸了我的图像映射 - 还有其他人有这个问题吗?