Skip to Content
avatar image
Former Member

BaseController

I have been following one tutorial, but I am having some troubles with the BaseController.

- Structure of my project

If I am not wrong, I have to do the following steps:

1- Create the BaseController.js

sap.ui.define([
		"sap/ui/core/mvc/Controller"
	], function (Controller) {
		"use strict";


		return Controller.extend("mapping.controllers.BaseController", { ...

2- Loading it in the view/fragment that I want to use it, and extend it.

sap.ui.define([
    'mapping/controllers/BaseController',
    'sap/ui/core/routing/History',
	'jquery.sap.global',
	'sap/ui/core/mvc/Controller',
	'sap/m/Popover',
	'sap/m/Button'
], function(BaseController, History, jQuery, Controller, Popover, Button) {
	"use strict";


	return BaseController.extend("mapping.controllers.Main", {

I am following that Steps by I get the following error:

captura.png (11.5 kB)
error.png (9.6 kB)
error.png (9.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Former Member

    It was just an stupid mistake. The name of the file was "BaseController.controller.js" instead of "BaseController.js" so it was failing. Solved

  • Get RSS Feed

2 Answers

  • Oct 27, 2017 at 08:41 AM
    -1

    The SAP UI5 documentation already specifies that this shouldn't be done. You're trying to load the resource asynchronously, but you're accessing it synchronously!! See https://sapui5.hana.ondemand.com/#/api/sap.ui (see method sap.ui.define)

    Thanks and best regards,

    Shilpa

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2017 at 03:58 AM

    I guess your problem is not with your base controller, but with your resource roots. You have mentioned return Controller.extend("mapping.controllers.BaseController", but in the error, it is looking for the location in mapping/mapping/controller/baseController.js.

    I suggest, you verify the resource roots in all your files, begining from your index.html

    Add comment
    10|10000 characters needed characters exceeded