mercredi 30 novembre 2016

EmberJs - and array of Class instances

I've defined a class like below

const OpenedCaseStatus = Ember.Object.extend({
  caseid: -1,
  isActive: false,
  selectedTabIndex : -1      
});

export default OpenedCaseInfo;

In my caseInfo service I have created an array openedCases which contains instances of class OpenedCaseStatus.

In one of my component I am injecting the caseInfo service and then in my template I am trying to print case information like:

<div>
    <ul>
        
            <li>caseStatus.caseid</li>
        
    </ul>    
</div>    

But this is not printing the data. Earlier it was working when I was populating the openedCases array with anonymous objects like below:

this.get('openedCases').pushObject({caseid: 1, isActive: true, selectedTabIndex: 0});
this.get('openedCases').pushObject({caseid: 2, isActive: false, selectedTabIndex: 1});
this.get('openedCases').pushObject({caseid: 3, isActive: true, selectedTabIndex: 3});

My question is why is not working with class instances. Is there any alternative?




Aucun commentaire:

Enregistrer un commentaire