on 03-28-2017 12:09 PM
When i create a simple UI5 app in webide, the default controller code generated is:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("ABC.controller.View1", {
});
});
Now, i prefer writing functions using keyword prototype and hence wanted to change this and changed to:
jQuery.sap.declare({
modName : "ABC.controller.View1",
type : "controller"
});
sap.ui.controller("ABC.controller.View1", new ABC.controller.View1Controller());
ABC.controller.View1Controller = function() {
};
Here, editor gives error as ABC is not defined and on running the app, the console gives Type error: ABC.controller.View1Controller is not a constructor.
Any idea why this should be happening?
In Index.html property data-sap-ui-resourceroots='{"ABC": ""} is also declared.
jQuery.sap.declare({
modName :"ABC.controller.View1Controller",type:"controller"});
how about this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This will not work as the modName is always the module name of the object be it view or controller. Because it's literal translation is to load ABC/controller/View1.js file and register it. See the sdk - https://openui5.hana.ondemand.com/#docs/api/symbols/jQuery.sap.html#.declare
User | Count |
---|---|
78 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.