Component:
import { Component, OnInit, TemplateRef } from '@angular/core';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
export class PatchListComponent implements OnInit {
modalRef: BsModalRef;
constructor(private modalService: BsModalService) {
openModal(template: TemplateRef<any>) {
this.modalRef = this.modalService.show(template);
}
}
}
Module:
import { ModalModule } from 'ngx-bootstrap/modal';
@NgModule({
declarations: [
MyComponent
],
imports: [
ModalModule.forRoot(),
]
})
export class MyModule { }
Getting the following error :
Property 'modalRef' has no initializer and is not definitely assigned in the constructor
Thanks in advance.