This repository has been archived by the owner on Jul 10, 2023. It is now read-only.
How to use component in different framework #1473
tavisca-nilesh
started this conversation in
General
Replies: 1 comment 1 reply
-
First off, when using Svelte components outside a Svelte app you'll need to compile them, so this template isn't the best choice and I think you should check out the official template which uses Rollup for the job. after compiling and publishing, you can consume your components like so: import SvelteComponent from 'my-svelte-component';
// Angular specific
@ViewChild('myDiv') myDiv: ElementRef<HTMLDivElement>;
// This will work only after AfterViewInit was called (or inside it)
const myComponent = new SvelteComponent({
target: myDiv,
props: {
// assuming SvelteComponent.svelte contains something like
// `export let answer`:
answer: 42
}
}) you can see the full API here. For publishing a component, have a look here. Hope this helps! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use components built in svelte in microfrontend application. i have following questions
How can we use these components in angular?
how to generate bundle or npm package so that I can use it in any framework? npm run publish not working
could you please add some descriptions and roles of each file in the template?
Beta Was this translation helpful? Give feedback.
All reactions