polymer: notifyPath + dom-repeat do not work with new array items

Polymer 1.0 does not track data model changes automatically, there is a notifyPath method to notify Polymer elements about changes in data model. https://www.polymer-project.org/1.0/docs/devguide/data-binding.html#set-path

What path should be notified when a new array item inserted to force refresh of <template is="dom-repeat">?

Non of these work:

this.notifyPath("array", this.array);
this.notifyPath("array.1", this.array[1]);
this.set("array." + this.array.length, {});

Here is a Plunker example to play with: http://plnkr.co/edit/UyoKIA90kJkkydO7Rhv4?p=preview

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 27 (4 by maintainers)

Most upvoted comments

This one works:

root.addProductByPush = function() {
    root.products.push({ name: "fx-8350" });
    root.notifyPath("products", root.products.slice());
};

But in this case (same as array.concat) the notifyPath value argument is a new array, and I would like to keep the old one, only notify Polymer about changes inside.