Skip to content

Commit 0677f82

Browse files
author
amandaesmith3
committed
modal/controller
1 parent 617dc96 commit 0677f82

File tree

7 files changed

+25
-35
lines changed

7 files changed

+25
-35
lines changed

static/usage/v7/modal/controller/angular/example_component_html.md

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
</ion-header>
77
<ion-content class="ion-padding">
88
<ion-button expand="block" (click)="openModal()">Open</ion-button>
9-
<p>{{ message }}</p>
109
</ion-content>
1110
```

static/usage/v7/modal/controller/angular/example_component_ts.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { ModalExampleComponent } from './modal-example.component';
99
templateUrl: 'example.component.html',
1010
})
1111
export class ExampleComponent {
12-
message = 'This modal example uses the modalController to present and dismiss modals.';
13-
1412
constructor(private modalCtrl: ModalController) {}
1513

1614
async openModal() {
@@ -22,7 +20,7 @@ export class ExampleComponent {
2220
const { data, role } = await modal.onWillDismiss();
2321

2422
if (role === 'confirm') {
25-
this.message = `Hello, ${data}!`;
23+
console.log(`Hello, ${data}!`);
2624
}
2725
}
2826
}

static/usage/v7/modal/controller/demo.html

+18-19
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,30 @@
2323
</ion-header>
2424
<ion-content class="ion-padding">
2525
<ion-button expand="block" onclick="openModal()">Open</ion-button>
26-
<p id="message">This modal example uses the modalController to present and dismiss modals.</p>
2726
</ion-content>
2827
</ion-app>
2928

3029
<script>
3130
const openModal = async () => {
3231
const div = document.createElement('div');
3332
div.innerHTML = `
34-
<ion-header>
35-
<ion-toolbar>
36-
<ion-buttons slot="start">
37-
<ion-button color="medium" onclick="cancel()">Cancel</ion-button>
38-
</ion-buttons>
39-
<ion-title>Welcome</ion-title>
40-
<ion-buttons slot="end">
41-
<ion-button onclick="confirm()" strong>Confirm</ion-button>
42-
</ion-buttons>
43-
</ion-toolbar>
44-
</ion-header>
45-
<ion-content class="ion-padding">
46-
<ion-item>
47-
<ion-input type="text" label="Enter your name" label-placement="stacked" placeholder="Your name"></ion-input>
48-
</ion-item>
49-
</ion-content>
50-
`;
33+
<ion-header>
34+
<ion-toolbar>
35+
<ion-buttons slot="start">
36+
<ion-button color="medium" onclick="cancel()">Cancel</ion-button>
37+
</ion-buttons>
38+
<ion-title>Welcome</ion-title>
39+
<ion-buttons slot="end">
40+
<ion-button onclick="confirm()" strong>Confirm</ion-button>
41+
</ion-buttons>
42+
</ion-toolbar>
43+
</ion-header>
44+
<ion-content class="ion-padding">
45+
<ion-item>
46+
<ion-input type="text" label="Enter your name" label-placement="stacked" placeholder="Your name"></ion-input>
47+
</ion-item>
48+
</ion-content>
49+
`;
5150

5251
const modal = await modalController.create({
5352
component: div,
@@ -58,7 +57,7 @@
5857
const { data, role } = await modal.onWillDismiss();
5958

6059
if (role === 'confirm') {
61-
document.querySelector('#message').innerHTML = `Hello, ${data}!`;
60+
console.log(`Hello, ${data}!`);
6261
}
6362
};
6463

static/usage/v7/modal/controller/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ import angular_modal_example_component_html from './angular/modal-example_compon
3636
src="usage/v7/modal/controller/demo.html"
3737
devicePreview
3838
includeIonContent={false}
39+
showConsole={true}
3940
/>

static/usage/v7/modal/controller/javascript.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</ion-header>
77
<ion-content class="ion-padding">
88
<ion-button expand="block" onclick="openModal()">Open</ion-button>
9-
<p id="message">This modal example uses the modalController to present and dismiss modals.</p>
109
</ion-content>
1110

1211
<script>
@@ -29,7 +28,7 @@
2928
<ion-input type="text" label-placement="stacked" label="Enter your name" placeholder="Your name"></ion-input>
3029
</ion-item>
3130
</ion-content>
32-
`;
31+
`;
3332
3433
const modal = await modalController.create({
3534
component: div,
@@ -40,7 +39,7 @@
4039
const { data, role } = await modal.onWillDismiss();
4140
4241
if (role === 'confirm') {
43-
document.querySelector('#message').innerHTML = `Hello, ${data}!`;
42+
console.log(`Hello, ${data}!`);
4443
}
4544
};
4645

static/usage/v7/modal/controller/react.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```tsx
2-
import React, { useState, useRef } from 'react';
2+
import React, { useRef } from 'react';
33
import {
44
IonButtons,
55
IonButton,
@@ -50,13 +50,12 @@ function Example() {
5050
const [present, dismiss] = useIonModal(ModalExample, {
5151
onDismiss: (data: string, role: string) => dismiss(data, role),
5252
});
53-
const [message, setMessage] = useState('This modal example uses the modalController to present and dismiss modals.');
5453

5554
function openModal() {
5655
present({
5756
onWillDismiss: (ev: CustomEvent<OverlayEventDetail>) => {
5857
if (ev.detail.role === 'confirm') {
59-
setMessage(`Hello, ${ev.detail.data}!`);
58+
console.log(`Hello, ${ev.detail.data}!`);
6059
}
6160
},
6261
});
@@ -73,7 +72,6 @@ function Example() {
7372
<IonButton expand="block" onClick={() => openModal()}>
7473
Open
7574
</IonButton>
76-
<p>{message}</p>
7775
</IonContent>
7876
</IonPage>
7977
);

static/usage/v7/modal/controller/vue/example_vue.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
</ion-header>
99
<ion-content class="ion-padding">
1010
<ion-button expand="block" @click="openModal">Open Modal</ion-button>
11-
<p>{{ message }}</p>
1211
</ion-content>
1312
</ion-page>
1413
</template>
1514

1615
<script lang="ts" setup>
1716
import { IonButton, IonContent, IonPage, IonHeader, IonToolbar, IonTitle, modalController } from '@ionic/vue';
1817
import Modal from './Modal.vue';
19-
import { ref } from 'vue';
20-
21-
const message = ref('This modal example uses the modalController to present and dismiss modals.');
2218
2319
const openModal = async () => {
2420
const modal = await modalController.create({
@@ -30,7 +26,7 @@
3026
const { data, role } = await modal.onWillDismiss();
3127
3228
if (role === 'confirm') {
33-
message.value = `Hello, ${data}!`;
29+
console.log(`Hello, ${data}!`);
3430
}
3531
};
3632
</script>

0 commit comments

Comments
 (0)