You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are represented as an array-like Object as so:
console.log(api.elements.length); // => 2
console.log(api.elements[0]._id); // => 713
console.log(api.elements[1]._id); // => 16
api.elements.push({'type': 'foo'});
api.elements[2].loadId().then(console.log); // => unique id (say, 199)
api.elements.splice(1, 1); // Removes the object with ID 16 in the API and locally
console.log(api.elements[0]._id); // => 713
console.log(api.elements[1]._id); // => 199
For all intents an purposes, api.elements acts like and array. It implements all the functions that a ES2015 array implements and when objects are added/removed does the necessary grunt work to keep the API up-to-date. Representing the API as an array, makes Polymer integration easy as dom-repeat works really well in this situation, except...it doesn't work because it has a Array.isArray check that discards our object and doesn't create a collection from it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!
I know there is an issues regarding repeating over object keys in #1385
However, I am working with array-like objects and these also do not get stamped out either due to the Array.isArray() check.
I'll add a PR which implements a further check on objects passed through dom-repeat has the required properties and methods. (https://www.polymer-project.org/1.0/docs/devguide/properties#array-mutation)
The text was updated successfully, but these errors were encountered: