jasonroyle / ng2-img-map

Responsive image mapping interface for Angular 2
MIT License
15 stars 25 forks source link

Multiple img-map #5

Open rhjennings opened 6 years ago

rhjennings commented 6 years ago

I'm able to get the img-map to work on a single page, however when I try to use the img-map on an additional page, I'm getting this error:

ImgMapComponent is part of the declarations of 2 modules: BuildIconPageModule and VariableIconPageModule! Please consider moving ImgMapComponent to a higher module that imports BuildIconPageModule and VariableIconPageModule. You can also create a new NgModule that exports and includes ImgMapComponent then import that NgModule in BuildIconPageModule and VariableIconPageModule.

Have you used img-map within multiple pages?

I tried to create a new component that exports the includes the ImgMapComponent, however the the following error happens:

Can't bind to 'markers' since it isn't a known property of 'img-map'.

  1. If 'img-map' is an Angular component and it has 'markers' input, then verify that it is part of this module.
  2. If 'img-map' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (">
    ][markers]="markers" (change)="onChange($event)">

"): ng:///BuildIconPageModule/BuildIconPage.html@2:73 'img-map' is not a known element:

Following your comments from a previous issue, if the ImgMapComponent is declared within the page that uses it, I was able to get that page to work, but only for one page.

Any thoughts?

rhjennings commented 6 years ago

I figured out how to convert the component to a module. So, it works now on multiple pages (I'm using it in an Ionic app), or multiple modules. I created a fork with the updated code to make it a module.