How pass data from ModalService into component

后端 未结 5 843
被撕碎了的回忆
被撕碎了的回忆 2021-01-23 05:09

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         


        
5条回答
  •  Happy的楠姐
    2021-01-23 05:37

    set @Input() parameter in the popup component to access the property in initialState
    
    for eg:
    in Parent Component
    
    const initialState = { message: 'popup message', title:'popup title'};
    let bsModalRef = this.modalService.show(ConfirmPopupComponent, Object.assign({}, this.modalConfig, { class: 'modal-sm', initialState })
    
    
    
    in confirmPopupComponent
    
    @Input() message: string = 'Message here...'; // we can set the default value also
    @Input() title: string = 'default title';
    

提交回复
热议问题