我正在使用Angular6和一个对话框组件以及Angular FullCalendar。我有一个工作日历。我正在尝试实现以下行为:单击某个事件时,将打开一个对话框,其中包含有关该事件的一些详细信息。当前,单击事件时,它不会第一次加载,而只有在第二次单击后才加载。例如,单击一个事件,没有任何显示,然后在屏幕上的任何地方再次单击,就会出现模式。实际的for row in c.n1ql_query(N1QLQuery("SELECT keyspace_id FROM system:indexes WHERE keyspace_id LIKE $test", test='test_val')):
print row
函数在第二次单击之前完成。与在param = 'XEXE%'
row_iter = cb.n1ql_query(N1QLQuery('SELECT BoardAsString FROM boardwascreated WHERE BoardAsString LIKE $mystring', mystring=param))
函数中注入openModal
有什么关系?
日历部分: TS:
ModalComponent
HTML:
openModal
模式代码: TS:
this.calendarOptions = {
height:500,
editable: false,
eventLimit: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
eventClick: (calEvent, jsEvent, view) => {
let data = {
title: calEvent.title,
start: calEvent.start,
end: calEvent.end,
price: calEvent.price,
subject: calEvent.subject,
subtotal: calEvent.price,
b_id: calEvent.b_id
};
this.openModal(data);
}
}
openModal(data) {
const modalRef = this.modalService.open(ModalComponent);
modalRef.componentInstance.data = data;
}
HTML:
<div class="calendar-container">
<angular2-fullcalendar #calendar [options]="calendarOptions" (initialized)="onCalendarInit($event)"></angular2-fullcalendar>
</div>
我已在Internet上搜寻该问题的解决方案,但是,对于我自己的一生,无法找到解决方案。有人可以帮忙吗?有没有一种方法可以从HTML端调用import { Component, OnInit, Input, AfterViewInit } from '@angular/core';
import {NgbModal, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-modal',
templateUrl: './modal.component.html',
styleUrls: ['./modal.component.css']
})
export class ModalComponent implements OnInit {
constructor(public activeModal: NgbActiveModal) { }
@Input() public data;
ngOnInit() {
console.log(this.data)
}
}
函数。我尝试了 <div role="document" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{{ data.title }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button>
</div>
</div>
</div>
,但是无法获取实际的特定事件数据。
对此有任何帮助或建议吗?