What Is the Lifecycle of a Controller in SAP UI5?

Leaves of different age of jack fruit tree on white wooden background.

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

Most Recent Articles

Will SAP UI5 replace the SAP Web UI?

SAP Full Forms

More Similar Articles

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.