ionic-team / ionic-team/ionic-docs

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

Đang mở
#1,626 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
content
Ngôn ngữ chính
MDX
Star
621
Fork
3.2k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
86

Mô tả

# 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](https://github.com/ionic-team/ionic/blob/0f242fd956f8cf0143ef36e9cadb1f8dac62cadd/core/src/components/modal/modal.tsx#L154)

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](https://stackoverflow.com/questions/52465154/ionic-4-angular-how-to-self-dismiss-a-modal/54969834#54969834)

**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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.