0

Gist

I have an application running AngularJS and Angular side by side, using the UpgradeModule. I have "upgraded" and AngularJS component (angular.component) for use in our Angular components (@Component). I have done so using the instructions on the Angular 1.x upgrade page.

The issue is that when this "upgraded" component is declared in the AppModule declarations: [] array, I receive an error saying unknown element 'tooltip'.

When I remove the declaration from the AppModule and declare it instead in the @NgModule for the component in which the upgraded component will be used, it works fine.

Please review the Gist for the code that is being used.

1 Answer 1

1

There is nothing wrong with the behavior.

  • The components must be declared in the module where you want to use it.

  • If you want to use the component in multiple modules, Create a SharedModule (shared module) and add your component to it's declarations and exports.

  • Import the SharedModule in other modules wherever you want to use this component.

More about shared modules in Angular2 Docs.

And here is a nice tutorial on NgModules that might help you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.