Search code examples
angularbootstrap-modalngx-bootstrap

Call multiple parent methods from child modal ngx boostrap angular 5


I'm able to call a parent method from a child method however when I try to call another method It doesn't call the second method from the parent component.

this.bsModalRef = this.modalService.show(ActaModalComponent,{data, class: 'modal-lg'});
        this.bsModalRef.content.saved.take(1).subscribe(this.listActs.bind(this));
        this.bsModalRef.content.update.take(1).subscribe(this.listBits.bind(this));

I call the first method from the child model like this

saved: EventEmitter<any> = new EventEmitter();
update: EventEmitter<any> = new EventEmitter();

this.saved.emit();
this.update.emit();

I've been searching for anything similar on the web with no luck, any help would be appreciated.


Solution

  • Are you missing the @Output decorator? Does this help?

    @Output() saved = new EventEmitter<any>()
    @Output() update = new EventEmitter<any>()
    

    Also is take(1) necessary? That will cause the stream to complete after the first emit I believe.