aurelia / templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
MIT License
32 stars 26 forks source link

Associate Array binding - model update is not syncing with the view #26

Closed chandmk closed 9 years ago

chandmk commented 9 years ago

Version: 0.12

export class Test {
  Data = [[0,1],[2,3]]

  addone() {
    this.Data[0][0]++;
  }
}
<template>
<input type="text" value.bind="Data[0][0]" />
  <button click.trigger="addone()" value="Add One" >Add One </button>
</template>

When I click AddOne button, I am expecting that cell to have its value incremented by 1.

jdanyow commented 9 years ago

duplicate of https://github.com/aurelia/binding/issues/64

chandmk commented 9 years ago

Then, is the following code idiomatic in aurelia?

export class Test {
  Data = [[0,1],[2,3]]

  addone(evt) {
   evt.target.value++;
  }
}
<template>
<input type="text" value.bind="Data[0][0]" />
  <button click.trigger="addone($event)" value="Add One" >Add One </button>
</template>
jdanyow commented 9 years ago

Per https://github.com/aurelia/binding/issues/64, no, it is not idiomatic to bind to a particular index of an array and be updated when the value stored at that index changes.

Please review the comments in https://github.com/aurelia/binding/issues/64 for more details.