Coder Social home page Coder Social logo

Comments (3)

nlitwin avatar nlitwin commented on July 18, 2024

I was able to pass regular HTML attributes to the Vue component's root element after parsing through ngVueLinker's elAttributes and setting them as attrs in:

<Component {...{ directives }} {...{ props: reactiveData._v, on }} {...{ attrs }}>
    { <span ref="__slot__" /> }
</Component>

However, this only works for static values like tabindex="0" and doesn't get updated dynamically if you set an HTML attribute to an Angular expression like:

<button disabled="ctrl.shouldDisable"></button>

I'm now currently looking at how to make these HTML attributes update based on changes in the Angular controller. At first I tried to instantiate or modify Vue's $attrs (https://vuejs.org/v2/api/#vm-attrs), but it looks like this might not be possible. Next, I'm going to try modifying watchExpressions.js to set up watchers for the the attrs object I created from the parsed elAttributes. Hopefully this can be done!

from ngvue.

nicolaspayot avatar nicolaspayot commented on July 18, 2024

Hi! This is definitely an interesting feature to add. Thank you for looking into it.

Indeed, $attrs is Read only. I haven't been thinking deeply about how to handle this use case but you might be on the right path.

Anyway, feel free to throw a PR, I'll happily review it 😉

from ngvue.

nicolaspayot avatar nicolaspayot commented on July 18, 2024

Resolved by #61

from ngvue.

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.