<link rel="import" href="../vendors/polymer/polymer.html">

<dom-module id="backbone-collection-renderer">
  <template>
    <content id="content"></content>
  </template>
</dom-module>

<script>
  Polymer({
    is: 'backbone-collection-renderer',
    properties: {
      collection: {
        type: Object,
        observer: '_onCollectionChange'
      },
      models: {
        type: Array,
        value: function() {return [];}
      }
    },
    _onCollectionChange: function(next, prev) {
      if (prev) {
        prev.off(null, null, this); // Remove all callbacks with this context
      }
      next.on("add remove change reset", this.renderModelsToTemplate, this);
      var el = Polymer.dom(this).node.querySelector(".content");
      el.items = next.models;
      this.renderModelsToTemplate();
    },
    renderModelsToTemplate: function() {
      var _this = this;
      this.splice('models', 0, this.models.length);
      this.collection.each(function(model) {
        _this.push('models', model);
      });
    },
    ready: function() {
    }
  });
</script>

<link rel="import" href="../vendors/polymer/polymer.html">

<dom-module id="backbone-collection-renderer">
  <template>
    <content id="content"></content>
  </template>
</dom-module>

<script>
  Polymer({
    is: 'backbone-collection-renderer',
    properties: {
      collection: {
        type: Object,
        observer: '_onCollectionChange'
      },
      models: {
        type: Array,
        value: function() {return [];}
      }
    },
    _onCollectionChange: function(next, prev) {
      if (prev) {
        prev.off(null, null, this); // Remove all callbacks with this context
      }
      next.on("add remove change reset", this.renderModelsToTemplate, this);
      this.renderModelsToTemplate();
    },
    renderModelsToTemplate: function() {
      var el = Polymer.dom(this).node.querySelector(".content");
      if (el) {
        if (!el.items) {
          el.items = [];
        }
        el.splice('items', 0, el.items.length);
        this.collection.each(function(model) {
          el.push('items', model);
        });
      }
    }
  });
</script>

Fix bcr rendering new items
Fix bcr rendering new items
