Skip to content

Commit 702daa5

Browse files
committed
docs(modal): example of modals and NavParams
1 parent 729fa9c commit 702daa5

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

ionic/components/modal/modal.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ import {Animation} from '../../animations/animation';
1818
* modal can later be closed or "dismissed" by using the ViewController's
1919
* `dismiss` method. Additionally, you can dismiss any overlay by using `pop`
2020
* on the root nav controller.
21-
*
22-
* Data can be passed in through the Modal.Create() function as a second argument.
23-
* This data is available in the modal on the ViewController object as the parameter
24-
* "data".
25-
*
21+
*
22+
* Data can be passed to a new modal through `Modal.create()` as the second
23+
* argument. The data can gen be accessed from the opened page by injecting
24+
* `NavParams`. Note that the page, which opened as a modal, has no special
25+
* "modal" logic within it, but uses `NavParams` no differently than a
26+
* standard page.
27+
*
2628
* * @usage
2729
* ```ts
28-
* import {Modal, NavController, ViewController} from 'ionic/ionic';
30+
* import {Modal, NavController, NavParams} from 'ionic/ionic';
2931
*
3032
* @Page(...)
3133
* class HomePage {
@@ -44,22 +46,12 @@ import {Animation} from '../../animations/animation';
4446
* @Page(...)
4547
* class Profile {
4648
*
47-
* constructor(viewCtrl: ViewController) {
48-
* this.viewCtrl = viewCtrl;
49-
* }
50-
*
51-
* grabData() {
52-
* let passedData = this.viewCtrl.data;
53-
* }
54-
*
55-
* dismiss() {
56-
* this.viewCtrl.dismiss();
49+
* constructor(params: NavParams) {
50+
* console.log('UserId', params.get('userId'));
5751
* }
5852
*
5953
* }
6054
* ```
61-
*
62-
*
6355
*
6456
* A modal can also emit data, which is useful when it is used to add or edit
6557
* data. For example, a profile page could slide up in a modal, and on submit,

0 commit comments

Comments
 (0)