I am trying to bind array fetched from Mongo to Polymer webcomponent
Polymer({
is: 'project-collection',
properties: {
items: {
type: Array,
value: Projects.find({}).fetch(),
}
},
...
I also tried some variations, I made function objectCollectionSync() to listen changes in Mongo
objectCollectionSync = function(mongoCollection, callback) {
callback(mongoCollection.fetch());
mongoCollection.observe({
added: function() {
callback(mongoCollection.fetch());
},
changed: function() {
callback(mongoCollection.fetch());
},
removed: function() {
callback(mongoCollection.fetch());
},
movedTo: function() {
callback(mongoCollection.fetch());
},
});
}
and using of objectCollectionSync() in Polymer webcomponent
ready: function() {
objectCollectionSync(Projects.find({}), function(result) {
this.items = result;
});
},
With <project-collection item="{{ stringify projects }}"></project-collection>
it works fine, but it seems like a dirty solution. I want to build whole application with webcomponents with just a little bit of Blaze. Is there any non hacky solution?