dimanche 22 août 2021

assign Ember component variable with a Map

I have an Ember Component, Inside it, I declared a variable and after that I put a map inside the variable like this:

const SubscriptionForm = Ember.Component.extend({
     messagesFilter: Ember.Map.create(),
     
      init() {
          this.set('messagesFilter', this.getMessagesFilter());

and this is the getMessagesFilter function:

  getMessagesFilter() {
     let map = new Map();
     for (var i = 0; i < this.get('availableMessages').length; i++){
       let array = [];
       map.set(this.get('availableMessages').get(i), array);
     }

   return map;
 },

I verified that getMessagesFilter return a map with data inside. I don't undestand why when I do console.log(this.get('messagesFilter')) returns undefined.

Could someone help me with this?




Aucun commentaire:

Enregistrer un commentaire