Coder Social home page Coder Social logo

Comments (2)

karol-f avatar karol-f commented on September 28, 2024

Hi @patzick, thanks for the issue.

it has to be called in timeout in angular component so for some small amount of time, when
element is visible, there is no handler for event

Hmm, can You prepare JSFiddle/Plunkr/Codepen for this scenario? Maybe Angular somehow delays rendering? Llike when working with Vue, usually you have to do setTimeout(..., 0) when you want to deal with DOM.

when the element is hidden, caused by the ng-if action, and showed up then obviously
eventListener stops working too.

It's because ng-if creates/removes DOM nodes. Try to use ng-show - it should help as there will always be the same DOM node

To ease working with events maybe create Angular directive which will automatically apply addEventListener (or Angular's jQuery Lite bind() or on()) on element. I've googled some trivial example - http://stackoverflow.com/a/39368223/1616437 or http://jsfiddle.net/Z6RzD/156/ but I don't know if bind() will work with Custom Events that vue-custom-element use. If not change that to addEventListener.

If you will have some other questions feel free to ask them.

Regards!

from vue-custom-element.

karol-f avatar karol-f commented on September 28, 2024

If you will have some other questions or request for some more examples feel free to re-open this issue.

from vue-custom-element.

Related Issues (20)

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.