Turns out the solution was simply to set up an onChanged for ref :)
<polymer-element name="firebase-list" attributes="list" extends=
"firebase-element">
<script>
(function () {
'use strict';
Polymer({
refChanged: function() {
console.log(this.ref);
this.list = Firebase.getAsArray(this.ref);
}
});
})();
</script>
</polymer-element>
Sweet :)
On Thursday, December 4, 2014 11:43:29 AM UTC+1, [email protected] wrote:
>
> I'm trying to extend the firebase-element to enable wrapping "arrays" as a
> javascript list, as per: https://github.com/katowulf/Firebase.getAsArray
>
> I have the following element, firebase-list which extends firebase-element.
>
> <link rel="import" href=
> "../../bower_components/firebase-element/firebase-element.html">
>
> <script src="firebase-as-array.js"></script>
> <polymer-element name="firebase-list" attributes="list" extends=
> "firebase-element">
> <script>
> (function () {
> 'use strict';
>
>
> Polymer({
> list: null,
> attachedCallback: function() {
> console.log(this.location);
> this.locationChanged();
> console.log(this.ref);
> this.list = Firebase.getAsArray(this.ref);
> }
> });
>
>
> })();
> </script>
> </polymer-element>
>
> My problem/question is, how do I manage setting `this.list` properly, as
> it is done async?
> My index.html just renders and doesn't update the list... ah, I guess I
> have to set an observer on `_list` and then set my published list property
> when ready?
>
> <body unresolved>
> <h1>Hello World</h1>
> <template is="auto-binding">
> <firebase-list location="https://owjo5nyx9dj.firebaseio-demo.com" list
> ="{{list}}"></firebase-list>
> <h1>List</h1>
> {{list}}
> <template repeat="{{item in list}}">
> <li>{{item.name}}</li>
> </template>
>
>
> <!-- build:js scripts/app.js -->
> <script src="scripts/app.js"></script>
> <!-- endbuild-->
> </body>
>
> Thanks or any tips on best practice for handling this. Cheers!
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/5e0289af-ed5a-4e9a-b75e-cf37215e976b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.