Angular - Call parent method from child modal created by service -
i have parent component displaying list of records in table. each record has button can click , calls method called newversioncheck()
, seen below.
// creates new version target createnewversion(){ alert('create new version flow'); } /** * if draft exists, prompt user load , modify existing * or discard , create new draft. if no draft exists, * use createnewversion flow * * @param {any} ruleid * @memberof versionscomponent */ newversioncheck() { let versionhasdraft = false; // check see if target has draft. // if dont, take them new version flow if (!_.find(this.mapversionsdata, { isdraft: '1' })) { this.createnewversion(); }else{ // our draft version object let versionobj = _.find(this.mapversionsdata, { isdraft: '1' }); // tell our subject data sending modal this._mapsservice.updateconfirmexistingversionmodaldata({ targetid: this.targetid, createdbyqid: this.qid, clonerules: 1, versionobj: versionobj, }); // call our modal, pass confirmexistingversionmodalcomponent this.bsmodalref = this.modalservice.show(confirmexistingversionmodalcomponent); } }
this opens modal
component , pass data display in body.
my problem here modal, want able call createnewversion()
upon button click in parent component.
normally, use eventemitter
@output
, pass data child. however, since modal called service, don't know how go doing that.
i tried adding parent constructor of modal got circular dependency error.
how can call method modal?
Comments
Post a Comment