content: document the correct way to close the parent modal from a child component

Open
#1,626 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular
Domain
documentation

Research direction

Start with the linked modal documentation and inspect core/src/components/modal/modal.tsx around the componentProps handling. Confirm whether the modal instance passed to the child is the supported way to dismiss the parent, then document the stable usage and link it from the relevant modal guidance.

Written by the indexing model from the issue text.

Description

content

Bug Report

Ionic version:

[x] 4.5

Current behavior:

this.modalCtrl.dismiss closes a modal instance most recently opened, not a parent one ( https://github.com/ionic-team/ionic/tree/v4.5.0/core/src/components/modal#dismissing-a-modal )

and we found the modal instance is passed in addition to componentProps

It seems that using modal instance passed through @Input or NavParams is correct way to close the parent modal.

Is this behavior stable?

Expected behavior:

If it is, this behavior should be documented.

Other information:

related StackOverflow question

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0
   Ionic Framework               : @ionic/angular 4.4.2
   @angular-devkit/build-angular : 0.13.6
   @angular-devkit/schematics    : 7.3.6
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 8.0.0, browser 6.0.0, ios 5.0.1
   Cordova Plugins       : cordova-plugin-ionic 5.3.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.5.0, (and 22 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/buko106/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v10.16.0 (/Users/buko106/.anyenv/envs/nodenv/versions/10.16.0/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001
Dominant language
MDX
Stars
621
Forks
3.2k
Avg merge
1d 2h
Merged PRs (30d)
86

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ionic-team/ionic-docs

All issues in ionic-team/ionic-docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.