Closed
Description
I came to realise that if I pass a function to firebase
like I would pass to data
in one of my
components, it does not get called. I want to pass a route parameter to my query innovation
.
# editor.vue
firebase: ->
console.log 'evaluating' # not logging
data =
innovation: db.innovation @$route.params.innovation_slug
# alternative editor.vue: this is effectively binding innovation to the data source
firebase:
innovation: db.innovations() # query working, but route not available
# db.coffee
module.exports = ->
url = 'project-2654865812003744343.firebaseio.com'
firebase =
innovation: (slug) =>
ref = new Firebase url
ref.child('innovations').orderByChild('name').equalTo(slug)
innovations: =>
ref = new Firebase url
ref.child 'innovations'
return firebase
I also tried binding the data sources in the ready
hook.
# editor.vue
ready: ->
@$bindAsObject('innovation', db.innovation(@$route.params.innovation_slug)) # not binding
Am I doing something wrong? Do you have a recommended approach or a working example?