Accessing the CHIP API and the contracts

Context

With the CHIP API you can access the contracts and all elements defined in the CHIP definition file.

Procedure

  1. To access the CHIP API from the controller of your project, retrieve it via the SAPUI5 view:
    (function () {
      "use strict";
      sap.ui.controller("someController", {
        onInit: function () {
          var oChipApi = this.getView().getViewData().chip;
          ...
        },
        ...
      });
    }());
  2. You now can access the contracts as properties as described in the following topics.
    As a prerequisite for using a contract, you must consume this contract in the CHIP definition XML. The respective property is then available in the CHIP API object.