Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

How to get model data from component

$
0
0

@rzky wrote:

This is so stupid. How the heck do you access model data from inside component? This is my first attempt on using Ember Data.

So, I have a component that’s being called like this:

{{article/article-full
  article=model.article
  popular=model.popular
  categories=model.categories
}}

Inside the article-full.js component, i need to do some checking to either show or hide one of the field.

showMonth: true,

didReceiveAttrs() {
  let month = this.get('article').month;
  if (month == 'all') {
    this.set('showMonth', false);
  }
}

But this.get('article').month doesn’t actually give me anything meaningful.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles