首页 > 解决方案 > 无法读取 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>

标签: angularngx-bootstrap

解决方案


推荐阅读