【发布时间】:2016-04-18 16:14:14
【问题描述】:
我想在我创建的下拉 div 顶部添加 ng2-bootstrap 的日期选择器弹出窗口。当这不起作用时,我尝试创建一个简单的多级下拉列表。最终,我希望在单击我拥有的下拉列表时显示日期选择器弹出窗口。你能帮忙吗?这是我的代码。
我是社区的新手。如果我遗漏了任何应该包含的信息,请告诉我。
import {Component} from 'angular2/core';
import {DROPDOWN_DIRECTIVES, DATEPICKER_DIRECTIVES} from "ng2-bootstrap/ng2-bootstrap";
@Component({
selector: 'multilevel-dropdown',
template: `
<div>
<div dropdown [autoClose]="'disabled'">
<div dropdownToggle id="TopLine" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<H1>Today's date is: {{dt | date:'short'}} (click date for pop-up)<b class="caret"></b></H1>
</div>
<div class="dropdown-menu">
<div class="dropdown dropdown-submenu">
<div id="FirstPopup" class="dropdown-toggle" data-toggle="dropdown" aria-labelledby="TopLine" aria-expanded="false">
<H3>First Popup (implemented as dropdown) (click this text for next popup)<b class="caret"></b></H3>
<!--Following should be replaced with the div commented later for datepicker popup-->
<div class="dropdown-menu">
<div class="dropdown dropdown-submenu">
<div id="SecondPopup" class="dropdown-toggle" data-toggle="dropdown" aria-labelledby="FirstPopup" aria-expanded="false">
<H5>Second Popup (implemented as dropdown)</H5>
</div>
</div>
</div>
<!--<div id="SecondPopup" class="dropdown-menu dropdown-menu-right" aria-labelledby="FirstPopup">-->
<!--<datepicker [(ngModel)]="dt" [showWeeks]="false"></datepicker>-->
<!--</div>-->
</div>
</div>
</div>
</div>
</div>
`,
directives: [DROPDOWN_DIRECTIVES, DATEPICKER_DIRECTIVES]
})
export class MultilevelDropdownComponent {
public dt:Date= new Date();
}
【问题讨论】:
标签: datepicker angular angular2-directives