Skip to content
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

Integrating svelte injector into existing angularjs application #3

Open
XShep opened this issue Sep 6, 2022 · 1 comment
Open

Integrating svelte injector into existing angularjs application #3

XShep opened this issue Sep 6, 2022 · 1 comment

Comments

@XShep
Copy link

XShep commented Sep 6, 2022

Hi,

I tried to integrate Svelte components into an existing AngularJS application by using svelte-injector, but I always fail to successfully load it and the documentation of svelte-injector is not very clear to me.

Do you have an existing example, maybe on codesandbox.io, how to integrate Svelte components into AngularJS.
If you have one for ReactJS it would be fine too.

@KoRnFactory
Copy link
Owner

KoRnFactory commented Dec 21, 2022

Hi,

sorry for the late response, here you are with some working examples

AngularJS

Here is a CodeSandbox with a barebone AngularJS project.

Now you can use your svelte components links this:

<svelte-component component="my-component-identifier"></svelte-component>

React

Here is a CodeSandbox with a barebone React project.
I realized I need to update the helper component for React, cause it only works with Typescript. In this example I rewrote it in place.

In general, the main steps are:

  1. Adding the loader
  2. Writing App.svelte with <InjectedComponents/> and instantiating it (new App({target: domElement})).
  3. Adding the svelteComponent helper to your existing components.
  4. Linking your Svelte components with some identifier.

If you could highlight what parts of the docs are unclear, I will try to make them more helpful.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants