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.

Add attribute to configure value property

See original GitHub issue

Say I have an array like this: [{id: 1, name: "name"}]

Now, the actual selected value, will be the id, but what I want to display is the name. So I wish I could use power-select like this: {{#power-select keyField='id' options=options selected=selectedId onchange=(action (mut selectedId))}} as |option|}} {{option.name}} {{/power-select}}

To fix this, i currently have to make a custom computed property, that maps from the selected object to write the selected id internally, and return the selected object based on the selected id.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cibernoxcommented, May 4, 2016

You can

{{#power-select options=options selected=(find-by 'id' selectedId options) onchange=(action (mut selectedId) value="id")}} as |option|}} 
  {{option.name}} 
{{/power-select}}

Note: find-by is a helper you can find in https://github.com/DockYard/ember-composable-helpers

0reactions
drauschenbachcommented, Mar 20, 2018

Resolves issue #160

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element.setAttribute() - Web APIs | MDN
setAttribute () Sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a...
Read more >
How to add an attribute to a property at runtime - Stack Overflow
This is "adding attribute to the PropertyDescriptor " extracted from type and has no sense unless you are trying to build a type...
Read more >
Configuring Attributes | Apple Developer Documentation
With an entity selected, click Add Attribute at the bottom of the editor area. · In the Attributes list, double-click the newly added...
Read more >
Python's property(): Add Managed Attributes to Your Classes
In this step-by-step tutorial, you'll learn how to create managed attributes, also known as properties, using Python's property() in your custom classes.
Read more >
How to get, set, and remove attributes and properties with ...
Today, we're going to look at how to get, set, and remove attributes and properties with vanilla JS. We'll also learn the difference...
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