PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: Arno on October 05, 2009, 06:46:54



Title: Independent component inside view
Post by: Arno on October 05, 2009, 06:46:54
I'm wondering how to solve this problem inside pureMVC. Maybe i'm making it to difficult.

I have an application that registering every mediator if the view is selected in the menu. If another view is selected the mediator gets removed. In some views I have the same component and it is cleaner to remove this part of the view and mediator for the different pages/views and put everything in 1 component. The problem is where can I register the mediator that is behind this component?

I think the best solution would be if I only have to say this in the parent view: <custom:Component id="testComponent"/>

And that the component himself would register the mediator. Or is there another way? Or should I register, assign and remove the mediator inside the mediator of the parent view?


Title: Re: Independent component inside view
Post by: puremvc on October 05, 2009, 07:13:51
Registering the mediator from within the component isn't what you want to do. The component should not be aware of its mediator. Instead, have the parent component's mediator do the registration.

-=Cliff>


Title: Re: Independent component inside view
Post by: Arno on October 05, 2009, 07:16:36
Oke! thank you for the fast reply