Skip to content

feat(angular): add standalone provideIonicAngular - #27996

Merged
liamdebeasi merged 20 commits into
FW-4612from
FW-4766
Aug 15, 2023
Merged

feat(angular): add standalone provideIonicAngular#27996
liamdebeasi merged 20 commits into
FW-4612from
FW-4766

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Aug 15, 2023

Copy link
Copy Markdown
Contributor

Issue number: N/A


What is the current behavior?

Developers using standalone Ionic UI components have no Angular way of bootstrapping Ionic and passing a config. Also, components using dist-custom-elements will be hidden because Ionic Core expects a hydrated class.

What is the new behavior?

  • Exposed a provideIonicAngular function. This is added at the root of an application (typically in main.ts). This function sets the ion-ce class to show custom element components and initialize Ionic with a developer-specified config.
  • Added tests to verify components are visible and the config is being set correctly.
  • Restructured the entry point of the test app so that provideIonicAngular can be set at the application root.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: angular @ionic/angular package label Aug 15, 2023
@liamdebeasi
liamdebeasi changed the base branch from FW-4612 to config-refactor August 15, 2023 15:21
Base automatically changed from config-refactor to FW-4612 August 15, 2023 15:45
@liamdebeasi liamdebeasi changed the title Fw 4766 feat(angular): add standalone provideIonicAngular Aug 15, 2023
export const provideIonicAngular = (config?: IonicConfig): Provider[] => {
/**
* TODO FW-XXXX
* Use makeEnvironmentProviders once Angular 14 support is dropped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried copy and pasting the implementation of makeEnvironmentProviders. This worked on ng15+ but broke on ng14. I'm not aware of a way to do feature detection here, so I opted to go without it for now.

@liamdebeasi
liamdebeasi marked this pull request as ready for review August 15, 2023 16:37
@liamdebeasi
liamdebeasi merged commit ca53682 into FW-4612 Aug 15, 2023
@liamdebeasi
liamdebeasi deleted the FW-4766 branch August 15, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants