代码:
from django.forms import ModelForm, TextInput, Textarea
from .models import *
class noteForm(ModelForm):
class Meta:
model = note
fields = ('title', 'note')
widgets = {
'title': TextInput(attrs={'class': 'form-control', 'placeholder':'title'}),
'note': Textarea(attrs={'class': 'form-control', 'rows':'16','placeholder':'note'})
}
public showCalendar: boolean;
问题:
单击按钮时,我的<div class="input-group-append">
<button
class="btn btn-outline-secondary dropdown-toggle end-date"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
(click)="showCalendar = !showCalendar"
>
<i class="oi oi-calendar"></i>
</button>
<div class="dropdown-menu" (click)="keepDropDownOpen($event)">
<div style="width: 360px;" *ngIf="showCalendar">
<dl-date-time-picker
[(ngModel)]="endDate"
[(startDate)]="startDate"
(change)="endDateSelected($event)"
minuteStep="15"
>
</dl-date-time-picker>
</div>
</div>
</div>
正确设置为显示元素。
如果我单击其他位置,则该元素(下拉列表)被隐藏,但是现在我必须单击两次按钮才能再次显示该元素。
在Bootstrap下拉菜单外部单击时,如何将*ngIf
设置为showCalendar
?