What Is the Lifecycle of a Controller in SAP UI5?


An SAP UI5 controller provides lifecycle hooks. Those hooks base on the lifecycle of the controller’s view.  A view instantiates before a controller.

Here is in what order an application executes in SAP UI5.

And here is the lifecycle of a control in SAP UI5.

  • application invokes a view
  • instantiate the view and its controller
  • load controller
  • onInit hook (after the view is instantiated)
  • onBeforeRendering hook (before view is rendered)
  • onAfterRendering hook (after view is rendered)
  • onExit hook (after view is destroyed)
  • controller is destroyed

The on init and on exit methods are called exactly one time per view instantiation. The on before rendering and on after rendering methods are called every time a view gets invoked.

For example, call a function in the controller’s on after rendering method to invoke a function every time after the controller’s view is rendered:

// in your controller

], function(Controller) {
  "use strict";
  return Controller.extend(function() {
    // hook gets invoked after the view is rendered  
    onAfterRendering: function() {



    _console: function() {

      sap.base.Log.info("foo bar"); // foo bar
No Comments

Get A COMPLETE SAP Modules Overview infographic (free)

Plus, receive for free SAP tips & insights and all future infographics that are only shared with the private newsletter subscribers. 

Complete SAP modules/components overview infographic.
Latest Poll
Essential Ressources

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.