Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use it? #1

Open
kristianmandrup opened this issue Dec 4, 2014 · 0 comments
Open

How do I use it? #1

kristianmandrup opened this issue Dec 4, 2014 · 0 comments

Comments

@kristianmandrup
Copy link

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant