Skip to content

How do I use it?  #1

Description

@kristianmandrup

I'm trying to DRY up the Q&A Firebase demo app using globals to configure the firebase endpoint.
Not sure how to use the namespace and set a single global key value?

PS: Components page referenced in README is 404.

<pvc-globals namespace="firebase.endpoint" values="https://fire-people.firebaseio.com"></pvc-globals>
<firebase-login id="baseLogin" user="{{user}}" statusKnown="{{statusKnown}}" location="{{globals.firebase.endpoint}}" provider="github" on-login="{{onLogin}}" on-error="{{onLoginError}}"></firebase-login>

I would like to create a firebase-model element sth like this

<firebase-model id=“answers” endpoint=“{{globals.firebase.endpoint}}” path="questions/{{questionId}}/answers/{{id}}” data=“{{answer}}”

Perhaps you can help me to find a nice way to do this for a win/win ;)

<polymer-element name="firebase-model" attributes="endpoint path" extends="firebase-element">  
  <script>
    (function () {
      'use strict';

      Polymer({
        observe: function() {
          endpoint: 'updateLocation',
          path: 'updateLocation'
        }

        // we can only set the list atribute when ref has changed (ie. not null)
        updateLocation: function() {
          this.location = [this.endpoint, this.path].join('/');
        }
      });

    })();
  </script>
</polymer-element>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions