Is it possible to keep the PolymerElement(“polymer-element-name”) declarations in a single Angular2 Module and have its children benefit from it?
I see that at the moment i have to declare the elements in each child module, otherwise they wont benefit from it.
I’ve tried exporting the declarations from my shared module but i get the following error:
“Can’t export directive class5 from SharedAppModule as it was neither declared nor imported!”.
While this is not a major issue, its a bit annoying at times. Is it possible to achieve this in any way?
Hi! I think you could create a global function and in the declarations just call that function and it would return all the PolymerElement and other declarations. This way you wouldn’t have to write same declarations again manually. Let me know if it works.
Hey there and thank you for your reply. Sorry for being so late with a reply.
I tried creating a Polymer declarations constants variable that gets exported and import it into each of my modules declarations, but angular detects this as me declaring the same class multiple times in my modules and throws a error:
“Type class0 is part of the declarations of 2 modules: AppModule and GroupsModule! Please consider moving class0 to a higher module that imports AppModule … etc”
The way i did it was :
[code]
import { PolymerElement } from “@vaadin/angular2-polymer”;
export const POLYMER_DECLARATIONS = [
PolymerElement(“paper-input”),
PolymerElement(“paper-drawer-panel”),
PolymerElement(“paper-card”),
… etc
];
[/code]and in my modules: