popover icon indicating copy to clipboard operation
popover copied to clipboard

Anchor Service is shared if used in a extended custom component

Open Venipa opened this issue 2 years ago • 0 comments

so for example i've created my own component by extending the popover class like this: export class MyCustomComponentPopover extends SatPopover implements OnInit

but the anchoring service will conflict with the next instantiated custom popover if loaded in the same module. so if i load MyCustomComponentPopoverA & MyCustomComponentPopoverB in the same module the service will always pick MyCustomComponentPopoverB as the Popover which results in MyCustomComponentPopoverA opening MyCustomComponentPopoverB.

to fix this you'll need to provide the anchoring service anew but without using an existing anchoring service:

@Component({
  selector: 'app-my-custom-component-popover-a',
  providers: [{ provide: SatPopoverAnchoringService, useExisting: false }]
})
export class MyCustomComponentPopoverA extends SatPopover implements OnInit {}

Venipa avatar Aug 13 '21 09:08 Venipa