Doua Beri
Doua Beri

Reputation: 10949

Importing components in Nativescript Angular

I recently start playing with Nativescript (angular) and I wanted to import a video player plugin. Everything worked great however I was a little confused with the code they used in demo which lead me to this page: Integrating UI components with Angular https://docs.nativescript.org/plugins/angular-third-party

Following the example provided

import {registerElement} from "nativescript-angular/element-registry";
registerElement("third-party-view", () => require("./third-party-view").SimpleTag);

and then use third-party-view in your template <third-party-view prop1="value1"></third-party-view> got me thinking why do you need to use registerElement instead of importing the component from an Angular module? After all that is the Angular way of doing things, or am I missing something?

Upvotes: 1

Views: 565

Answers (1)

Manoj
Manoj

Reputation: 21908

Not all the plugins are Angular compatible. If the author of a plugin supports Angular, he would have written the appropriate Angular module which you will just import. Register element is an alternative when the plugin doesn't impelement Angular module out of box.

Upvotes: 2

Related Questions