dimanche 28 décembre 2014

MVC: Inserting a view from a SubController to its Parent controller


I have 2 controllers: 1 top level controller,MainController, and a SubController, which MainController has an instance of and controls. The SubController has a Subview which goes inside the MainView as some sub web element.


What is a good way to insert the SubView into MainView? I can think of:


1) I can give SubController and SubView a reference of the MainView and append to it in the Subview


2) Return the html from the SubView rendering function to SubController, which returns to it to the MainController -> MainView -> render


Or is there a much better way?





Aucun commentaire:

Enregistrer un commentaire