0

I use surprised why my repeat.for binding doesn't react on array change. Then I found out Aurelia array observation doesn't react on array[index] = newItem.

This is confirmed when I read the spec https://github.com/aurelia/binding/blob/master/test/array-observation.spec.js

The array observation only reacts on methods pop/push/reverse/shift/sort/splice/unshift. Replacing the whole array works too.

I can fix my issue with splice instead of using array[index] = newItem;

But I would like to know is it technically too difficult to react on array[index] = newItem for Aurelia array observation?

huocp
  • 3,898
  • 1
  • 17
  • 29
  • 1
    it's not difficult, you just need signal binding behaviour. http://stackoverflow.com/a/38640748/3715792 – Kici Sep 15 '16 at 11:56
  • thx @kici, that would help. I need to remember to signal it every time I use `arr[i] = newItem`. Would like to see Aurelia support this natively in future. – huocp Sep 15 '16 at 22:55
  • I tried signal, it doesn't work on repeat.for binding but works on other bindings. Don't know is this designed behaviour. – huocp Sep 15 '16 at 23:58
  • Absolutely not. – Kici Sep 16 '16 at 05:02
  • I don't think this is the right place for your question, since you're not really asking for a solution to your problem but rather for an extra feature in the Aurelia framework. Why not submit a feature request on their Github? – Fred Kleuver Sep 28 '16 at 15:49
  • @FredKleuver thx, will do that. – huocp Sep 29 '16 at 00:17

1 Answers1

0

This is offcially unsupported in Aurelia.

https://github.com/aurelia/binding/issues/509

huocp
  • 3,898
  • 1
  • 17
  • 29