What is the suggested way to define global variable in new UI5 webide project.
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("test.controller.View1",
{
oView: null,
onInit: function() {
oView = this.getView();
},
});
});
When defined as above , i am facing an error that oView is not defined.
I have another ui5 project where controller was defined in a different way and working fine.
sap.ui.controller("test.view.main",
{
oView: null,
onInit: function() {
oView = this.getView();
},
Why does the way controllers defined for each version. Its getting tough to catch up the pace the changes are being made to project definitions at regular intervals.