当包含选择框的模板通过ng-include包含时,Bootstrap选择不起作用

时间:2017-05-19 12:03:27

标签: javascript html angularjs

这是我的index.html页面。

<head>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css">
<link rel="stylesheet" href="css/header.css">
<link rel="stylesheet" href="css/homepage_search_styles.css"> 

<script src="assets/js/jquery-2.1.0.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>

<script src="js/controller.js"></script>
<script src="js/quickview.js"></script>
</head>

<body ng-app="myApp">
    <div ng-include="'testsearch.html'"></div> 
</body>

这是testsearch.html

<div ng-controller="exampleController">
<div>
    Blah blah blah
</div>
<select name="model" id="model" class="selectpicker" data-live-search="true" multiple ng-model="sel" title="Any">
  <option data-tokens="Restaurant">Restaurant </option>
  <option data-tokens="Vegetarian">Vegetarian</option>
  <option data-tokens="Bar">Bar</option>
  <option data-tokens="Night Life">Night Life</option>
  <option data-tokens="Breakfast">Breakfast</option>
  <option data-tokens="Fast Food">Fast Food</option>
</select>
<div> Blah blah blah</div>
</div>

当我运行index.html时,会出现除选择框之外的所有其他组件。

此外,如果我直接在index.html中包含testsearch.html模板,则会出现选择框。

有人可以告诉我它为什么会那样?

0 个答案:

没有答案