mercredi 17 août 2016

Getting undefined for findBy

Ember findBy method is returning undefined, i'm new to ember and not able to figure out what am i doing wrong. I see that user and account data is present in store when viewed through Ember Inspector. Using the 2.7.0 version of ember and ember data.

this.get('store').findRecord('user', userId,{'include': 'accounts'}).then((user) => {
      this.set('currentUser', user);
      return user.get('accounts');
    }).then((accounts) =>{
      this.set('allAccounts', accounts);
      let account = accounts.findBy('primary');
      this.set('currentAccount',account);
      resolve();
    }).catch((error) => {
      reject(error);
    });




Aucun commentaire:

Enregistrer un commentaire