简体   繁体   中英

Can't model in the view in emberjs

I am just getting started with ember... I managed to save the data to firebase but can't get it to the client, this is my code:

Route:

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

template:

{{#each model}}
    <h2> {{model.title}}</h2>
{{/each}}

modeljs:

import DS from 'ember-data';

export default DS.Model.extend({
  title: DS.attr('string'),

});

I did manage to save an item to firebase with a form on my website so the model is sending data to firebase but I am not sure how to get it back to the view?

The template is wrong.

This is the correct one :

{{#each model as |item|}}
    <h2> {{item.title}}</h2>
{{/each}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM