jaredmcateer / ngVue3

Use Vue 3 components in your Angular 1.x app
https://jaredmcateer.github.io/ngVue3/
MIT License
20 stars 2 forks source link

Using a component inside another component #44

Closed XShep closed 9 months ago

XShep commented 9 months ago

Hello, I have a small problem.

I have a component that is registered globally in a file ngVue.js where all core initialize. Inside this component I want to use another component which is also registered in the same ngVue file. I also tried to import it inside the component, but nothing worked. The console gives an error. [Vue warn]: Failed to resolve component: component-name. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. Looks like it doesn't see the registered component at all. Am I doing something wrong, or is this not implemented?

Also, along with this error, another one appears regarding props, since, of course, I’m trying to use them in a non-existent component. [Vue warn]: Failed to resolve directive: props-size

What could I be doing wrong, and how can I solve this?

jaredmcateer commented 9 months ago

Hard for me to say without seeing some code but registering Vue components via ngVue only makes them available to Angular. If you want to use a Vue component inside another Vue component you'd do it the normal way of importing it in your script body (or components property in Options API) in order to make it available in the template.

XShep commented 9 months ago

Thanks for the answer. I tried to import the component just like that and use it, but I didn’t notice at all that I had to use the component property. Since the project does not have access to Vue files, I calmly imported the compiled JS file and connected it via the attribute.