3 ms·
> the google engineer started by instantiating the controller from the view Sort of playing devil's advocate here, but what did you not like about that approac
by oblio 10y ago
> the google engineer started by instantiating the controller from the view
Sort of playing devil's advocate here, but what did you not like about that approach? I'm guessing he should have used dependency injection? Am I missing something else?
- JustSomeNobody 10y agoSpeaking generally (ie: not about Angular), your main app should instantiate the controller, view and model and (constructor) inject model and view into your controller.
- strictfp 10y agoThe controller is supposed to control the view, thats why it's called controller. The controller sends data to the view for presentation and reacts to events from the view and updates the model accordingly. This way the view becomes quite passive, it only knows how to present data and where to send events. You separate the display from the driving of the display.