Access to ElementRegistry from CustomContextPadProvider

Hi,

I’m trying to create new item in popup menu and attach action onClick event to hide all descendant objects from selected task.

As starting point I created CustomContextPadProvider according to this example and it works fine. We have similar topic how to hide elements here

My question is how to access to elementRegistry from CustomContextPadProvider? Should I inject elementRegistry to CustomContextPadProvider and how to do that? We can get elementRegistry from modeler or viewer, but how to do that from CustomContextPadProvider? Or I should take some better approach?

Thanks
Rafal

You’d need to inject the element registry like so:


function CustomContextPadProvider(elementRegistry) {


  // do something with the element registry
}

CustomContextPadProvider.$inject = [ 'elementRegistry' ];

Great! It works perfectly!

Thanks @nikku