mardi 30 octobre 2018

Find number of records in the Returning model, in Ember js

// model

export default DS.Model.extend({
    name: attr('string'),
    owner: belongsTo('user'),
    num: attr('number'),
});

// route

export default Route.extend({
    model: function(){
        return this.store.query('post',{
            owner: 1
        });
    }
});

I want to know the number of records in the returning model ie.,it returns

{
       "name":"test1",
       "owner": 1,
       "num": 5
   },
   {
       "name":"test2",
       "owner": 1,
       "num",7
   },
   {
       "name":"test3",
       "owner": 1,
       "num": 2
   }

I want to get the value 3 as it has 3 records




Aucun commentaire:

Enregistrer un commentaire