angular - 无法读取 null 的属性“createText”
问题描述
我对角度很陌生。我有一个弹出单击按钮的模态,因为我在其他几个地方需要这个(按钮和模态),我为此创建了一个单独的组件,但不幸的是我收到了上述错误。
模态组件
export class NotificationModalComponent {
msgRef: BsModalRef;
constructor(private modalService: BsModalService ) { }
getNotify(template?:TemplateRef<any>){
this.msgRef = this.modalService.show(template);
}
<button (click)="popsModal('msgmodal')">
<ng-template #msgmodal>
<div class="modal-body text-center">
<h3>Allow Notifications</h3>
<small>Click allow to get push notifications</small>
</div>
</ng-template>
其他父组件
<app-modal></app-modal>
解决方案
推荐阅读
- c++ - 在 C++ 中通过虚拟表访问函数
- plsqldeveloper - 导出我创建的自定义模板
- powershell - VSCode Powershell 自动更正别名参数未按预期工作
- python - 我可以将 numpy 函数转换为 tensorflow 函数吗?
- azure - ASP.NET Core 2.1 应用程序启动失败时在 Application Insights 中创建错误
- screeps - 你如何在爬虫中攻击结构
- python - Heroku 上的 Python Flask 应用程序(Telegram Bot)未运行
- python - 未创建会话:此版本的 chromedriver 仅支持版本 []
- php - 我刚刚在我的系统中安装了 laragon 并出现问题“应用程序无法正确启动(0xc000007b)”
- azure - 从 Azure 逻辑 APP 调用 Jenkins API 以触发作业