Issue
i am using angular 10, i am trying to do show a modal in my component, but i get this error:
Type '{ componentParent: this; }' has no properties in common with type 'Partial<RegisterEnterpriseComponent>'
Code:
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
bsModalRef: BsModalRef;
constructor(
public modalService: BsModalService, public mybsModalRef: BsModalRef) {
}
openModal(id) {
const initialState = {
componentParent: this
};
this.bsModalRef = this.modalService.show(RegisterEnterpriseComponent, {initialState}); // The error is in this line
this.bsModalRef.setClass('modal-lg');
this.EnterpriseService.closeModal = this.bsModalRef;
}
I have used this function before with angular 8, but i dont know why is not working in this version of angular...
Anyone can help me with this?
Thank you!
Solution
Problem solved.
If someone is facing the same problem, in newer versions of ngx-bootstrap the arguments required doesn´t need the initialParent anymore:
I just had to put it in this way:
this.bsModalRef = this.modalService.show(RegisterEnterpriseComponent);
And it works without any problems.
Answered By - Luis Bermúdez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.