question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support two-way biding for 'value' property for custom elements

See original GitHub issue

Description

Right now, is not possible to add a two-way biding to the property ‘value’ of a custom element, you can do a two-way biding to the attribute value, but attribute value and property value are not the same:

image

When you try to bind to the property value an exception is displayed:

Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '@bind' is not a valid attribute name.
    at e.applyAttribute (https://localhost:44395/_framework/blazor.server.js:8:37951)
    at e.insertElement (https://localhost:44395/_framework/blazor.server.js:8:37062)
    at e.insertFrame (https://localhost:44395/_framework/blazor.server.js:8:35939)
    at e.insertFrameRange (https://localhost:44395/_framework/blazor.server.js:8:39834)
    at e.insertElement (https://localhost:44395/_framework/blazor.server.js:8:37019)
    at e.insertFrame (https://localhost:44395/_framework/blazor.server.js:8:35939)
    at e.applyEdits (https://localhost:44395/_framework/blazor.server.js:8:34325)
    at e.updateComponent (https://localhost:44395/_framework/blazor.server.js:8:33641)
    at Object.t.renderBatch (https://localhost:44395/_framework/blazor.server.js:1:70742)
    at e.<anonymous> (https://localhost:44395/_framework/blazor.server.js:19:18070)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pranavkmcommented, Aug 10, 2020

After further discussion, this might need some design work to implement.

1reaction
pranavkmcommented, Aug 10, 2020

This should be possible, although we need to document it. Parking this as a doc item.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement two-way data binding for custom property
The [(x)] syntax is easy to demonstrate when the element has a settable property called x and a corresponding event named xChange ....
Read more >
Support two-way-data-binding with custom-input-elements
Is the goal to make bind:value compatible with all custom elements? It seems like once you get to the point of needing to...
Read more >
Two-way binding
Two -way binding gives components in your application a way to share data. ... The following sizerComponent has a size value property and...
Read more >
Angular — Custom two way data binding | by Preethi
Property Binding ​​ The square bracket tells the angular to evaluate the expression given in the right hand side and it is a...
Read more >
How to create your own two-way data bindings with custom ...
A simple trick on how to create your own data bindings with custom components in #angular. ➡️At Hackages, our aim is to connect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found