No Comments

What Is the Lifecycle of a Controller in SAP UI5?

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

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

  • application invokes a view
  • instantiate the view and its controller
  • load controller
  • onInit hook (view is instantiated & view’s controls are created)
  • onBeforeRendering hook (view is re-rendered)
  • onAfterRendering hook (view is rendered)
  • onExit hook (view is destroyed)
  • controller is destroyed

For example, put a funtion into the onAfterRendering method to invoke the function every time when the view of the controller is rendered:

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



    _console: function() {

      console.log("foo bar"); // foo bar

Here is in what order an application executes in SAP UI5. And here is the lifecycle of a control in SAP UI5.

Most Recent Articles


Will SAPUI5 replace the SAP CRM Web UI soon?

Loading ... Loading ...

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.