简体   繁体   中英

call to current component method from a imported component - not parent child concept

I am in LotoReviewTabComponent and another component is imported here - import { ReviewComponent } from './loto.reviewdoc.component';

My requirement is to call a method of LotoReviewTabComponent inside ReviewComponent .

Reason ReviewComponent is imported in LotoReviewTabComponent is - there is a modalreference call in LotoReviewTabComponent as below -

Const reviewModal = this.modalService.open(ReviewComponent, ngbModalOptions);
reviewModal.componentInstance.fileName = fileName;

when some event is performed in that modal - reviewModal, a method in LotoReviewTabComponent has to be called.

how can this be achieved?.

You can use an Output event from angular in the ReviewComponent.

With this you can let the parent component (LotoReviewTabComponent) know that it has to do something. In this case, run a method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM