-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
feat(angular): use standalone components with routing #25589
Conversation
TODO: Need to rebase 6.3 against |
@@ -30,5 +30,5 @@ export abstract class EnvironmentInjector implements Injector { | |||
/** | |||
* @internal | |||
*/ | |||
abstract onDestroy(callback: () => void): void; | |||
abstract onDestroy?(callback: () => void): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to align with the type signature of the EnvironmentInjector
type from @angular/core
. We are maintaining our own "version" of the types, since we cannot update our library dependencies to target Angular 14. When I originally ported this, I forgot to make the onDestroy
callback optional.
Without this change, developers would receive a typescript language server warning in their IDE that the type of their environmentInjector
does not match the type signature of what we are expecting to be passed in.
* The `EnvironmentInjector` provider instance from the parent component. | ||
* Required for using standalone components with `ion-router-outlet`. | ||
* | ||
* Will be deprecated and removed when Angular 13 support is dropped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a tech debt ticket for this? (Ditto for ion-tabs
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm indifferent since this is an experimental API that could be ripped out completely if either Angular doesn't proceed with standalone as part of the official public API or if don't think it is a good architectural fit with Ionic.
I think once we consider it public API, having tech debt to maintain it could make sense.
But we also don't have many experimental features, so if we want to follow our existing process like everything else, I'm happy to create tickets 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. Are these test app config changes intentional or do we just need to resync feature-6.3
with main
?
The changes to the test apps are intentional. Removed the non-applicable README, added a missing tsconfig and created a script to sync only the e2e content changes (faster than syncing all of the node modules and app files when trying to modify a cypress test file in the base app). The ng14 test app changes are required to validate the standalone routing behavior works. |
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Standalone components do not work within Ionic's routing implementation.
Issue URL: #25404
What is the new behavior?
environmentInjector
property toion-router-outlet
andion-tabs
to enable developers to make use of standalone components with routing in Angular 14.Does this introduce a breaking change?
Other information
Dev-build:
6.1.14-dev.11657224247.185f8192
In your Angular 14 application, you will need to expose the new
EnvironmentInjector
to Ionic routing components (ion-router-outlet
andion-tabs
).For example: