Comments (11)
@typeoneerror - Play around with http://jsbin.com/fidowu/edit?html,output. You will see that the selected
attribute (what you see in the "Elements" pane in the Chrome DevTools) never updates even if you change which option is selected. This is (roughly) because the attribute is only used for initial render, and from then forward the property is used.
from ember-truth-helpers.
You have discovered the difference between attributes and properties. Welcome to my nightmare.
from ember-truth-helpers.
As to what @MichielDeMey mentioned, how I've handled this in the past was by creating a custom clone of the eq
helper called aeq
(Poor naming, but it's short):
https://gist.github.com/krivaten/a7662fea8da50b42e5ff2311643103f3
from ember-truth-helpers.
My general guess is that they are of different types, but we would really need a runnable demo to be sure.
from ember-truth-helpers.
I'm having the same issue.
I ultimately had to convert my integers to strings due to an API discrepancy.
Maybe we should introduce a non strict equality method? (==
)
from ember-truth-helpers.
I've just added a test case (I'll push it soon so you can see) that demonstrates this works as expected.. Is clientId
an integer in the first example? And if so, and if you are using Ember Data, then the ID in your models are being converted to strings automatically..
The following code
[{{eq 3 3}}] [{{eq '3' 3}}] [{{eq 3 '3'}}] [{{eq '3' '3'}}]
Produces the following output
[true] [false] [false] [true]
from ember-truth-helpers.
Seeing this in our app w/2.4 as well. I'm not positive it isn't a browser thing. I've got this in there:
And the <option>
does indeed select the correct item, but odd thing is: there's no "selected" property when I inspect the element in Chrome and Safari.
With just <option value="{{get item optionValuePath}}">
, the select doesn't select that item at all, so it's working, it just doesn't seem to be bound or something?
from ember-truth-helpers.
Logs false, true, false, false (true for the selected item). So it appears that eq is working, but the selected prop is not 100% working or something.
from ember-truth-helpers.
Even hard-coding in selected={{eq item.id "2"}}
selects the correct item but in the HTML, "selected=" attribute is not here. Will see if I can repro in a clean repo.
from ember-truth-helpers.
@rwjblue so this isn't really a truth-helpers issue then from the sound of it?
from ember-truth-helpers.
Having read the thread it seems like there is no bug in ember-truth-helpers. Let us forget about attributes v. properties 🧘♂️
from ember-truth-helpers.
Related Issues (20)
- Helper "not" has wrong value when passing PromiseProxy
- not-eq has unknown reexport HOT 1
- Helper is-empty returns false when passing undefined
- Update to ember-cli-babel@7 HOT 2
- `or` doesn't work the same way as `||` in JavaScript HOT 3
- Update `README` to note that `or`, `and` and `xor` **do** short-circuit HOT 2
- Short-circuit Problem With `SafeString` Using `or` (And Maybe Other Helper)
- Ember Global Deprecation Warning HOT 1
- `or` cant be used when or condition value can be `false` HOT 7
- Project maintenance HOT 4
- Typescript conversion HOT 1
- Can't `npm i` master branch to use with `ember-template-imports` HOT 2
- Cut a release? HOT 12
- Incorrect glint return type for `or` helper in 4.0.0-beta.0 HOT 2
- [QUESTION] `ember-source` compat HOT 3
- `and` returns non-boolean value rather than converting it (which breaks default value logic)
- Document usage with glint additionalSpecialForms config HOT 1
- Memory leaks with `and ` and `or` after they were converted to class based helpers HOT 3
- Importing from package root does not work in classic builds + `.gts`
- Show how to use in template imports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-truth-helpers.