angular - Angular如何在没有usign按钮的情况下显示模态
问题描述
我正在使用 ng-boostrap 并且我遇到了一个问题,我有一个从 API 获得的对象数组:
quaPacks: QualifiedSignaturePackDetailsResponse[] = [];
ngOnInit(): void {
this.notificationsService.getSignaturesPackNotification().subscribe({
next: value =>{
this.quaPacks=value
}
})
}
openModalTemplate(template: TemplateRef<any>) {
console.log(this.quaPacks+ "smth")
this.modalRef = this.modalService.show(template);
}
checkIfNull() : boolean {
if(this.quaPacks.length != 0) {
return true
}
}
HTML:
<div *ngIf="checkIfNull()">
<ng-template #template>
<ng-container [ngModel]="openModalTemplate(template)">
对于非空列表,模式未显示。我看到了很多使用父组件的解决方案,但我想单独做一个。谢谢你的帮助。
解决方案
推荐阅读
- javascript - 如何在 Firestore 文档中创建 Auto-ID?
- javascript - Kendo UI MVC调用javascript嵌套函数
- r - 遍历 dfs 列表,将 fn 应用于每个 df 中的相同 col
- python - Python在我下载视频时如何从youtube-dl获取下载百分比
- php - 如何使用 packagist 设置 composer 包
- android - LocalBroadcastManager 在 androidx.appcompat:appcompat:1.1.0 中找不到,但在 1.0.0 中可用
- javascript - 检查页面打印是否已打印,然后将其关闭
- tensorflow - 哪些 numpy 版本与 Tensorflow 1.14.0 兼容
- c# - 如何在 C# 和 Python 进程之间共享字节数组的内存
- java - 如何使用 Jackson 解析具有不同类型的无名数组