Giter VIP home page Giter VIP logo

Comments (3)

kryops avatar kryops commented on August 19, 2024

Hi @bertrandg

Sadly, I don't know that much about Angular's internals, I just read about the EVENT_MANAGER_PLUGINS somewhere and wanted to have some fun with it.

You'll probably have a better chance for a good answer on StackOverflow or Gitter

My guess would be that rendering happens on a module level and ignores the component's providers. Following EVENT_MANAGER_PLUGINS backwards in the Angular source leads you to something like this:

Compiler > NgModuleFactory > NgModuleRef > ComponentResolverFactory > ComponentResolver > RendererFactory2 > Renderer2 > EventManager > EVENT_MANAGER_PLUGINS

As for a workaround to your problem, did you try to add some sort of Feature Module that provided the event for just your component?

from ng2-events.

bertrandg avatar bertrandg commented on August 19, 2024

Hi,
Thanks to answer.

No sadly, adding a new module doesn't solve this, all my tests indicates whatever the module it is inside, it's global to the app and usable everywhere.
And if I add it inside a lazy loaded module, it's available nowhere even inside this module..

Only way I see to limit scope is to use a directive like this:
https://github.com/bertrandg/angular-split/blob/7b6b26a329dc39eebb6d591ce1512dbbda47516e/projects/angular-split/src/lib/directive/eventOutsideZone.directive.ts

I will still try on Gitter! :)

from ng2-events.

bertrandg avatar bertrandg commented on August 19, 2024

Check this for people interested about:
https://stackoverflow.com/questions/53835649/angular-how-to-use-a-custom-eventplugin-only-inside-specific-component-instead

That's not possible.

from ng2-events.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.