lundi 11 mai 2015

Introspecting Child Components in Ember

If I have two components involved in a list:

  • my-list
  • my-item

But let's say actually there are two types of "items" that a list might contain so there is another component:

  • my-other-item

At run time I instantiate my list with something like:

{{my-list items=items type='my-other-item'}}

What I'd like is that my my-list component be able to do some introspection on the item component that has been chosen and react appropriately. In my example, lets say that each item component has a meta-attribute called _aspects and I'd like to do something like:

if(App[type]._aspects === 'foo') { ... }

where 'type' is the name of the item component. Has anyone tackled this problem before?

I've included the 'ember-cli' tag as well as 'ember' only because maybe my problems are associated with not fully understanding the CLI's resolver




Aucun commentaire:

Enregistrer un commentaire