Controller Life Cycle Hook Methods
The controllers must be created with suffix[ .controller.js ] and it contains methods that define how the model and view interact with each other.
SAPUI5 Controller Life Cycle Hook Methods-
- onInit( )– It is called when the view is instantiated. This can be used to modify the view before it is displayed with the event handlers and perform the one-time initialization.
- onBeforeRendering( )– It is called every time the view is rendered, before the renderer is called and the HTML is placed in the DOM tree.
- onAfterRendeing( )-It is called when the view has been rendered, and therefore, its HTML is part of the document; used to do post-rendering manipulations of the HTML.
- onExit( )-It is called when the view is destroyed; used to free resources and finalize activities.
In addition to the hook method, other event handler and functions can be defined in the controller and also the controller can fire events for which other controller/entities can register.
The controllers with no views, no life cycle hooks are called.