I have a similar mocap enter image description here rectangles are companies, they can be edited or deleted (maybe there will be some more actions in the future) and in order not to produce icons in the future in a row they decided to do via popover.
The bottom line is .. we press the button one (html)

<button ion-button icon-only (click)="presentPopover(item)"> <ion-icon name="more"></ion-icon> </button> 

(company.ts)

 presentPopover(item) { let popover = this.popoverCtrl.create(PopoverPage, { company: item }); popover.present(); } 

and popover

 @Component({ template: ` <ion-list> <ion-list-header>Ionic</ion-list-header> <button ion-item (click)="close()">Редактировать</button> <button ion-item (click)="close()">удалить</button> </ion-list> ` }) export class PopoverPage { public company: any; constructor(public viewCtrl: ViewController,public params:NavParams) { this.company = params.data.company; } close() { this.viewCtrl.dismiss(); } } 

The question is how can I return the state to company.ts and run a method there that opens a window and accepts editing?

 presentEditModal(item){ this.translate.get(['Name', 'Address', 'Phone', 'Cancel', 'Save', 'Create', 'ukrainian', 'english']).subscribe((translation: string) => { let companyEditModal = this.modalCtrl.create(CompanyEdit, {item: item, apiService: this.apiService, translation: translation}); companyEditModal.onDidDismiss(data => { if(data) { let newItem = true; this.items.forEach((val, i) => { if (val.id == data.id) { newItem = false; return this.items[i] = data; } }); if (newItem) { this.items.push(data) } } }); companyEditModal.present() }); } 

note: code (click)="close()">Редактировать is now hardcoded for tests.

UPD: I work with him for the first day, but I think maybe, or somehow, kollbekami resolves from the present && dismiss, or something else ... I will be glad to any ideas. thank

    1 answer 1

    Yes, kollbek decides))

      popover.onDidDismiss(data => { if (data && data.action && data.company) { if (data.action == 'edit') { this.presentEditModal(data.company); } if (data.action == 'delete') { this.removeCompany(data.company); } } });