Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Expressions with tokenList, styleObject filters don't update dynamically #28

Open
arthurevans opened this issue Apr 29, 2014 · 17 comments
Labels

Comments

@arthurevans
Copy link

With an expression like:

{{ classes | tokenList }}

The expression doesn't update when one of the values inside classes is updated. For example you might expect to be able to toggle the 'selected' class like this:

this.classes.selected = !this.classes.selected

However, since the properties of classes aren't observed, the change isn't detected.

Test case:

http://jsbin.com/qamat/12/edit

The Broken Switch button (which updates the property) doesn't trigger a change to the binding.

The Working Switch button (which clones the object) does trigger a change.

May be related to the issues mentioned in PR #23, of knowing which values to observe.

@rafaelw
Copy link
Contributor

rafaelw commented Apr 29, 2014

Thanks for tracking this down

@warpech
Copy link

warpech commented May 14, 2014

+1

warpech added a commit to Juicy/juicy-tile-editor that referenced this issue May 14, 2014
@robdodson
Copy link

Related SO question

@peterwmwong
Copy link
Contributor

+1

@jmesserly jmesserly assigned jkomoros and jmesserly and unassigned jkomoros Aug 7, 2014
@roibh
Copy link

roibh commented Aug 11, 2014

<div class="{{ {selected: classes.selected} | tokenList }}">The Magic Div</div>

@silenceisgolden
Copy link

+1

@jmesserly jmesserly added the p1 label Aug 14, 2014
@plato-cambrian
Copy link

+1

@sorvell
Copy link
Contributor

sorvell commented Aug 28, 2014

@kennyjwilli
Copy link

+1

@jmesserly
Copy link
Contributor

one possibility is addressing this at the filter level, by having some filters that work more like "array views" and are live.

we could also observe the props of all the values ("classes" in above), but that adds more things we're Object.observing. Going to need to investigate what the perf implication of that is.

@plato-cambrian
Copy link

Is this triple binding of polymer models <> DOM <> angular ng-models any help?
https://github.com/eee-c/angular-bind-polymer

@steren
Copy link

steren commented Jan 17, 2015

Hi,
I think I see this problem, but when the parameter of one of my filter is an object or array: changing one of its properties does not trigger an expression refresh.

In this codepen: http://codepen.io/anon/pen/azJeEL?editors=101
You can see that the last repeat expression is not correctly filtered, because one of its filter takes an array in parameter, and that only one element of this array is modified.

@ianbibby
Copy link

+1

1 similar comment
@MetaMemoryT
Copy link

👍

@mattyclarkson
Copy link

This is a real problem. For example you cannot do the following:

this.pages = ['over', 'there'];

<p>Sorry, but the page <code>{{pages | join('/')}}</code> doesn't exist.</p>

join: function(array, delimiter) {
  return array.join(delimiter);
},

When the array changes the filter doesn't get updated resulting in an incorrect message.

I would happily tackle a PR if someone can point me in the right direction. Any tips, @rafaelw or @jmesserly ?

@dapullar
Copy link

dapullar commented Mar 9, 2015

+1

@shal1y
Copy link

shal1y commented Apr 3, 2015

👍
Right now the "filter" works more like a modifier. Filters are supposed to "filter" data/object/something... This would be amazing to have..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests