<div class="container" ng-controller="serviceHistoryController">
<!-- Search box Start -->
<div class="dropdown col-xs-8">
<button class="btn btn-default col-xs-4" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="false" aria-expanded="true">
Select SUT
<span class="caret"></span>
</button>
<ul class="dropdown-menu col-xs-8" aria-labelledby="dropdownMenu1">
<li ng-repeat="sutname in sutlist">
<a href="#" ng-click="sutselected(sutname)">
{{sutname.name}}
</a>
</li>
</ul>
</div>
</div>
上面是我使用的引導+角度下拉代碼。但是,一旦我點擊下拉菜單,它就會消失。我正在使用angular1 + boostrap 3.3.7和jquery 1.12.4庫。沒有使用其他腳本或js。點擊後引導下拉消失
以下是角功能
app.controller("serviceHistoryController",function($scope){
let menuitems = [{"sutid":"1","name":"AA"},
{"sutid":"2","name":"BB"},
{"sutid":"3","name":"CC"},
{"sutid":"4","name":"DD"},
{"sutid":"4","name":"EE"}]
$scope.sutlist = menuitems;
$scope.selectedSUT;
$scope.sutselected = function(sutname){
$scope.selectedSUT = sutname;
alert("dropdown sut selected:"+$scope.selectedSUT.name);
}
});
有一個在你的代碼一個錯字=>'詠歎調-haspopup = 「FLASE」'。它需要'假'不''flase' –
暴露您的sutselected角功能 – Aravind
@Aravind請檢查更新的問題 – vashishth