1
我已經在前端設置了下拉按鈕,現在只有在選擇了下拉項目時,我必須在單獨的內容塊中顯示我的數組。如何使用ng-click來渲染塊內的內容?
我該怎麼做?
這裏是我的plunker
HTML
<div ng-controller="DropdownCtrl">
<div class="row">
<div class="col-md-12">
<ul class="content">
<li ng-repeat= 'task in tasks'>
</li>
</ul>
</div>
</div>
<!-- Here goes dropdown menu !-->
<div class="btn-group" dropdown="" is-open="status.isopen">
<button id="single-button" type="button" class="btn btn-default btn-xl" dropdown-toggle="" ng-disabled="disabled">
Options <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="single-button">
<li role="menuitem">
<a href="javascript:void(false)" ng-click="show('tasks')">Display tasks</a>
</li>
</ul>
</div>
</div>
的js
var myApp = angular.module('myApp', ['ui.bootstrap']);
myApp.controller('DropdownCtrl', function ($scope) {
$scope.tasks = [
{title:'First Task'},
{title: 'Second Task'}
];
});