mardi 1 décembre 2015

Route that observes property on component that links to it

I have a list if items in an items route that uses a component event-item to display each of them. This component has two computed's on it that are setting some classes right now to show the user some info about each item...

classNameBindings: ['winning','closed'],
item: null,
winning: Ember.computed('item.item_high_bid_user_id','userService.user_id',function(){
    return this.get('item.item_high_bid_user_id') == this.get('userService.user_id');
}),
closed: Ember.computed('item.item_status',function(){
    return this.get('item.item_status') === 2;
})

In the component template each item in the list is wrapped in a link-to that links to the item route, which displays a single item.

In the item template and even route I would like to observe the winning and closed computed's that are on the corresponding component to show or hide some things in the item template (IE. hid the bidding section if an item is closed, etc.)

What would be the proper way to do this?

BTW I'm on Ember 2.2.0 Ember Data 2.2.0 and Ember-cli 1.13.13




Aucun commentaire:

Enregistrer un commentaire