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

Binding table cells to a Map #70

Closed heruan closed 8 years ago

heruan commented 8 years ago

I'm building a dynamic <table> where columns are bound to a schema described in a Map object. E.g.,

<table>
  <thead>
    <tr>
      <th repeat.for="[name, schema] of columns">${name}</th>
    </tr>
  </thead>
</table>

When columns.set("new", { sortable: true }) the column is correctly added to the table, but when columns.delete("new") I get this error:

Uncaught TypeError: Cannot read property 'firstChild' of undefined
    getAnimatableElement @ aurelia-templating.js:1096
    removeAt @ aurelia-templating.js:1247
    handleChanges @ map-collection-strategy.js:83
    handleCollectionChanges @ repeat.js:172
    call @ repeat.js:62
    callSubscribers @ aurelia-binding.js:219
    call @ aurelia-binding.js:715
    flushMicroTaskQueue @ aurelia-task-queue.js:110
    (anonymous function) @ aurelia-task-queue.js:60

Am I doing something wrong or is this a bug?

jdanyow commented 8 years ago

same error is happening here https://github.com/aurelia/binding/issues/239

martingust commented 8 years ago

Fixed in https://github.com/aurelia/templating-resources/commit/7f245ce3b490fa82cae20103281b665a07cf3eb2.

heruan commented 8 years ago

Thank you @martingust ! How can I test it on my app? Currently I have aurelia-templating-resources@^1.0.0-beta.1.0.1 installed with JSPM.

martingust commented 8 years ago

@heruan On this line change overrideContext to bindingContext.