-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(modal): add IonModalToken for injecting modal elements in Angular components #30474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
60c715b
feat(modal): add IonModalToken for injecting modal element in Angular…
ShaneK 21b2fa8
Merge branch 'main' of github.com:ionic-team/ionic-framework into FW-…
ShaneK 460aa73
fix(modal): adding IonModalToken as an Angular standalone import
ShaneK 85a1d0e
Merge branch 'main' of github.com:ionic-team/ionic-framework into FW-…
ShaneK c10e821
test(modal): adding programatic modal angular standalone tests for cr…
ShaneK 9b7b646
Merge branch 'feature-8.7' of github.com:ionic-team/ionic-framework i…
ShaneK 3de0874
fix(modal-test): fixing typo in programmatic
ShaneK 26b5472
fix(modal-test-ng19): fixing typo in programmatic
ShaneK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
export { MenuController } from './providers/menu-controller'; | ||
export { DomController } from './providers/dom-controller'; | ||
export { MenuController } from './providers/menu-controller'; | ||
export { NavController } from './providers/nav-controller'; | ||
|
||
export { Config, ConfigToken } from './providers/config'; | ||
export { Platform } from './providers/platform'; | ||
|
||
export { bindLifecycleEvents, AngularDelegate } from './providers/angular-delegate'; | ||
export { AngularDelegate, bindLifecycleEvents, IonModalToken } from './providers/angular-delegate'; | ||
|
||
export type { IonicWindow } from './types/interfaces'; | ||
export type { ViewWillEnter, ViewWillLeave, ViewDidEnter, ViewDidLeave } from './types/ionic-lifecycle-hooks'; | ||
export type { ViewDidEnter, ViewDidLeave, ViewWillEnter, ViewWillLeave } from './types/ionic-lifecycle-hooks'; | ||
|
||
export { NavParams } from './directives/navigation/nav-params'; | ||
|
||
export { IonPopover } from './overlays/popover'; | ||
export { IonModal } from './overlays/modal'; | ||
export { IonPopover } from './overlays/popover'; | ||
|
||
export { IonRouterOutlet, provideComponentInputBinding } from './directives/navigation/router-outlet'; | ||
|
||
export * from './directives/control-value-accessors'; | ||
export { IonBackButton } from './directives/navigation/back-button'; | ||
export { IonNav } from './directives/navigation/nav'; | ||
export { | ||
RouterLinkDelegateDirective, | ||
RouterLinkWithHrefDelegateDirective, | ||
} from './directives/navigation/router-link-delegate'; | ||
export { IonNav } from './directives/navigation/nav'; | ||
export { IonTabs } from './directives/navigation/tabs'; | ||
export * from './directives/control-value-accessors'; | ||
|
||
export { ProxyCmp } from './utils/proxy'; | ||
|
||
export { IonicRouteStrategy } from './utils/routing'; | ||
export { OverlayBaseController } from './utils/overlay'; | ||
export { IonicRouteStrategy } from './utils/routing'; | ||
|
||
export { raf } from './utils/util'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...es/angular/test/apps/ng19/src/app/standalone/programatic-modal/modal/modal.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<p> | ||
modal works! | ||
<ion-button (click)="close()">Close Modal</ion-button> | ||
</p> |
20 changes: 20 additions & 0 deletions
20
...ages/angular/test/apps/ng19/src/app/standalone/programatic-modal/modal/modal.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { IonButton, IonModalToken } from "@ionic/angular/standalone"; | ||
|
||
@Component({ | ||
selector: 'app-modal', | ||
templateUrl: './modal.component.html', | ||
imports: [IonButton], | ||
standalone: true, | ||
}) | ||
export class ModalComponent { | ||
constructor(@Inject(IonModalToken) private modalToken: HTMLIonModalElement) { | ||
this.modalToken.onDidDismiss().then(() => { | ||
console.log('Modal dismissed'); | ||
}); | ||
} | ||
|
||
public close() { | ||
this.modalToken.dismiss(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ular/test/apps/ng19/src/app/standalone/programatic-modal/programatic-modal.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<ion-button (click)="open()">Open Modal</ion-button> | ||
|
18 changes: 18 additions & 0 deletions
18
...ngular/test/apps/ng19/src/app/standalone/programatic-modal/programatic-modal.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from '@angular/core'; | ||
import { IonButton } from '@ionic/angular/standalone'; | ||
import { ProgramaticModalService } from './programatic-modal.service'; | ||
|
||
@Component({ | ||
selector: 'app-test', | ||
templateUrl: './programatic-modal.component.html', | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
standalone: true, | ||
imports: [IonButton] | ||
}) | ||
export class ProgramaticModalComponent { | ||
constructor(private modalService: ProgramaticModalService) {} | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public open() { | ||
this.modalService.open(); | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
.../angular/test/apps/ng19/src/app/standalone/programatic-modal/programatic-modal.service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { inject, Injectable } from '@angular/core'; | ||
import { ModalController } from "@ionic/angular/standalone"; | ||
import { ModalComponent } from "./modal/modal.component"; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ProgramaticModalService { | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#modalController = inject(ModalController); | ||
|
||
async open() { | ||
const modal = await this.#modalController.create({ | ||
component: ModalComponent, | ||
focusTrap: true, | ||
}); | ||
await modal.present(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/angular/test/base/src/app/standalone/programatic-modal/modal/modal.component.html
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
modal works! | ||
</p> |
11 changes: 11 additions & 0 deletions
11
packages/angular/test/base/src/app/standalone/programatic-modal/modal/modal.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
import { IonButton } from "@ionic/angular/standalone"; | ||
|
||
@Component({ | ||
selector: 'app-modal', | ||
templateUrl: './modal.component.html', | ||
imports: [IonButton], | ||
standalone: true, | ||
}) | ||
export class ModalComponent { | ||
} |
2 changes: 2 additions & 0 deletions
2
...s/angular/test/base/src/app/standalone/programatic-modal/programatic-modal.component.html
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<ion-button (click)="open()">Open Modal</ion-button> | ||
|
18 changes: 18 additions & 0 deletions
18
...ges/angular/test/base/src/app/standalone/programatic-modal/programatic-modal.component.ts
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Component } from '@angular/core'; | ||
import { IonButton } from '@ionic/angular/standalone'; | ||
import { ProgramaticModalService } from './programatic-modal.service'; | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Component({ | ||
selector: 'app-test', | ||
templateUrl: './programatic-modal.component.html', | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
standalone: true, | ||
imports: [IonButton] | ||
}) | ||
export class ProgramaticModalComponent { | ||
constructor(private modalService: ProgramaticModalService) {} | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public open() { | ||
this.modalService.open(); | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
packages/angular/test/base/src/app/standalone/programatic-modal/programatic-modal.service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { inject, Injectable } from '@angular/core'; | ||
import { ModalController } from "@ionic/angular/standalone"; | ||
import { ModalComponent } from "./modal/modal.component"; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ProgramaticModalService { | ||
ShaneK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#modalController = inject(ModalController); | ||
|
||
async open() { | ||
const modal = await this.#modalController.create({ | ||
component: ModalComponent, | ||
focusTrap: true, | ||
}); | ||
await modal.present(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.