You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ionic provides Angular injection tokens that allow you to access Ionic elements through Angular's dependency injection system. This provides a more Angular-idiomatic way to interact with Ionic components programmatically.
15
-
16
-
## IonModalToken
17
-
18
-
The `IonModalToken` injection token allows you to inject a reference to the current modal element directly into your Angular components. This is particularly useful when you need to programmatically control modal behavior, listen to modal events, or access modal properties.
19
-
20
-
Starting in `@ionic/angular` v8.7.0, you can use this injection token to streamline modal interactions in your Angular applications.
21
-
22
15
## Benefits
23
16
24
17
Using injection tokens provides several advantages:
@@ -28,6 +21,12 @@ Using injection tokens provides several advantages:
28
21
-**Simplified Code**: Eliminates the need for `ViewChild` queries or manual element references
29
22
-**Better Testing**: Easier to mock and test components that use injection tokens
30
23
24
+
## IonModalToken
25
+
26
+
The `IonModalToken` injection token allows you to inject a reference to the current modal element directly into your Angular components. This is particularly useful when you need to programmatically control modal behavior, listen to modal events, or access modal properties.
27
+
28
+
Starting in `@ionic/angular` v8.7.0, you can use this injection token to streamline modal interactions in your Angular applications.
29
+
31
30
### Basic Usage
32
31
33
32
To use the `IonModalToken`, inject it into your component's constructor:
@@ -150,7 +149,7 @@ When opening a modal that uses the injection token, you can pass the component d
0 commit comments