question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Dynamic bindings

See original GitHub issue

Hi there!

Quick question as we are tossing up whether to upgrade to Firestore. Can you do dynamic bindings like you can in Vuefire? e.g. if you need to get the authenticated users UID and then use this to build your binding e.g. user/{uid}, noting that an async call is made on the beforeCreate so this information is not available at the time the Vue component is built. Is this possible in this library?

Thanks a lot!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
amranidevcommented, Nov 27, 2017

@natezerk , I would like to inform you that vue-firestore is supporting the both of (collection/docs) in this new release v0.2.0, now you can bind your docs/collection in two ways, manually or via firestore option.

  • Binding Manually with $binding function that return a promise.
...
mounted() {
  // Binding Collections
  this.$binding("users", firebase.firestore.collection("users"))
  .then((users) => {
    console.log(users) // => __ob__: Observer
  })
  
  // Binding Docs
  this.$binding("Ford", firebase.firestore().collection("cars").doc("ford"))
  .then((ford) => {
    console.log(ford) // => __ob__: Observer
  }).catch(err => {
    console.error(err)
  })
}
...
  • Binding via firestore option.
var vm = new Vue({
  el: '#app',
  firestore() {
    return {
        // Collection
        persons: firestore.collection('persons'),
        // Doc
        ford: firestore.collection('cars').doc('ford')
    }
  }
})

Thanks!!

1reaction
ghostcommented, Nov 17, 2017

Thanks for the great response. I like the sound of supporting bindings for docs. Thanks a lot mate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Static vs Dynamic Binding in Java - GeeksforGeeks
The static binding uses Type information for binding while Dynamic binding uses Objects to resolve to bind. Overloaded methods are resolved ...
Read more >
Static Binding and Dynamic Binding in Java - Javatpoint
When type of the object is determined at run-time, it is known as dynamic binding.
Read more >
Newest 'dynamic-binding' Questions - Stack Overflow
I am Trying to do a Dynamic binding of form Controls from data base attributes and show automatically using API call in Angular...
Read more >
What is Static and Dynamic binding in Java with Example
The difference between static and dynamic binding is a popular Java programming interview question that tries to explore candidates' knowledge on having ...
Read more >
What is static and dynamic binding in Java - Wikitechy
What is static and dynamic binding in Java ? Answer : The binding which can be determined at compile time by compiler… 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found