No way to pass data to modal dialogs

This is more of a feature request I suppose.

Bug description:

Perhaps I’m missing something in the current implementation, but there seems to be no way to pass custom data to the modal service to pass along to the component used as the content of the dialog.

This means that; if you want the modal service to to open an angular component, you can’t tell the target component what object to use as it’s model unless you set that object on a service (or other in-memory variable-holder) prior to opening the dialog. This is particularly useful if the modal is showing a form.

Ideally some map-related constructor argument such as this would be extremely useful:

this.modalService.open(MyTargetComponent, dialogOptions, {title:"Edit My Object", editObject: data});

This could then can be accessed via the public activeModal: NgbActiveModal injector, such as:

this.title = activeModel.dialogData.title;

This would simplify passing data around that will be used just for the target component, as pre-setting and post-fetching data via a service is clunky and not very pretty for these kinds of scenarios.

Link to minimally-working plunker that reproduces the issue:

N/A

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 2.1.1

ng-bootstrap: 1.0.0-alpha.8

Bootstrap: 4.0.0-alpha.5

1 possible answer(s) on “No way to pass data to modal dialogs