jeudi 17 août 2017

Ember Firebase model() findAll not working

I'm trying to test Firebase with Ember.

Am using Ember 2.14.

I have a model call Mountain.

In my Mountains controller, I have a save action:

import Ember from 'ember';

export default Ember.Controller.extend({
  actions: {
    saveMountain(name, height, image) {
      let mountain = this.store.createRecord('mountain', {
        name: name,
        height: height,
        image: image
      });

      mountain.save();
    }
  }
});

So far that works. I see 3 records saved to my Firebase database after testing the save function.

However, in my moutains route, I am trying to return all mountains from the Firebase database using:

import Ember from 'ember';

export default Ember.Route.extend({
  model() {
    return this.get('store').findAll('mountain');
  }
});

My template looks like this:


<div>
  <img src="" alt="Photo of " /><br />
  <label>Name: </label><br />
  <label>Height: </label>
</div>

  <p>There are no mountains in the database yet.</p>




I keep seeing There are no mountains in the database yet. on my page instead of a list of records.

Am I doing something wrong or is there a bug with Firebase and Ember 2.14?




Aucun commentaire:

Enregistrer un commentaire