Apply Filter to Models

Hello,

I’m developing my first EmberJS and at the moment i have a doubt.

I have at the moment the following problem:

-I have one ArrayController PersonsController that generate a list of persons in a template -I have one ObjectController PersonController that generate the info about person

In the route persons/person/id i’m showing the persons list and the info about the selected person.

At the momment i’m trying to apply a filter to the ArrayController model and i’m filtering the list of persons but this filter has to filter to inside the objectController. How can i filter in the two controller with same filter? The model of object controller isn’t updating and i dont know how to access the objectController from ArrayController to manually filter the model.

Regards

For me it seems like you need to move this part

In the route persons/person/id i’m showing the persons list

to the common /persons route-controller and to add yield there for sub-routes. Does it make sense for you or you need more details?

Hello od1n,

Can you explain a bit better your suggestion?

I think that i cannot have the person list and the person info on the same template page if i have to do things in another way, because for every person that i click to view the info i have a different route.

Regards

And you actually don’t need it. Look, you have route persons which is including sub-route index by default. The next step is to generate sub-route person. persons and person have different controllers, routes (I mean Ember.Route), and templates. So you can obtain the list of persons in the route for persons. Then you need to add the {{yield}} keyword to the persons template and also render there the list of people.

Hello,

Thanks for the answer. What’s the difference between {{yield}} and {{outlet}}? (im using the outlet)

Regards

Oh, sorry, just used to rails, where yield keyword is used. I meant {{outlet}} previously.