I\'m trying to use ngx-bootstrap-modal to pass data from a modal service into a modal component. The examples show this:
this.modalService.show(ModalContentCompo
At the stage of creating a modal, every property from initialState
is copied to the component that you pass as a modal content.
For example, if your initialState
looks like this:
const initialState = {
list: [
'Open a modal with component',
'Pass your data',
'Do something else',
'...',
'PROFIT!!!'
],
title: 'Modal with component',
closeBtnName: 'Close'
};
Then all these properties are copied to your modal content component and they're accessible there and you can use them in your template or ngOnInit
as usual. In general, these properties are like @Input
.
Example - https://stackblitz.com/edit/angular-9n2zck?file=app/service-component.ts