mdbootstrap / mdb-angular-ui-kit

Angular 18 & Bootstrap 5 & Material Design UI KIT
https://mdbootstrap.com/docs/angular/
Other
1.12k stars 280 forks source link

Basic Modal Sample documentation #114

Closed urielzen closed 5 years ago

urielzen commented 5 years ago

ng-uikit-pro-standard-7.4.4

I am trying to follow the example in the following link to create a modal https://mdbootstrap.com/docs/angular/modals/basic/

Everything seemed to be working fine, I could see the modal showing on button interaction. But when I get to the part "Inject data to the modal"...... the data is not being passed.

I fixed the problem as I was typing my question. The documentation shows to pass the modalOptions like this:

this.modalRef = this.modalService.show(ModalComponent, { this.modalOptions });

but for me it worked only passing it like this

this.modalRef = this.modalService.show(ModalComponent, this.modalOptions);

Bloodcast69 commented 5 years ago

@urielzen

When you're passing options to the modalService in a flat way (without any variable) you should use the first way:

this.modalRef = this.modalService.show(ModalComponent, { backdrop: true });

But if you're having a variable which contains your options, you should pass it as the second example:

const modalOptions = { backdrop: true};
this.modalRef = this.modalService.show(ModalComponent, modalOptions); 
Bloodcast69 commented 5 years ago

this.modalRef = this.modalService.show(ModalComponent, { backdrop: true });

urielzen commented 5 years ago

Thanks for your answer, I understand what you are saying, I just wanted to point out that the documentation is incorrectly showing:

image