cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to load js file

marie-pierre_mela
Product and Topic Expert
Product and Topic Expert
0 Kudos
3,028

In a controller.js file, I want to reference a BaseController situated in another place. So at the top of the controller.js file I used:

sap.ui.define([

"../../controller/BaseController.controller",

"sap/ui/core/mvc/Controller",

"sap/ui/core/UIComponent"

], function (BaseController, Controller, UIComponent) {

But get a status 404 not found when loading the BaseContriller. the path for the file is indeed wrong: https://sapui5.hana.ondemand.com/resources/.../controller/BaseController.controller.js

Any idea how to get it right ?

View Entire Topic
WouterLemaire
SAP Mentor
SAP Mentor

Normally the basecontroller has no .controller.js extension but only .js. If that is also the case in your project, you just have to define the basecontroller without the .controller part. Like this:

"../../controller/BaseController”


Hope it helps.

marie-pierre_mela
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks, but doesn't help... 😞

WouterLemaire
SAP Mentor
SAP Mentor

Strange, try to compare with the basecontroller in this project: https://github.com/lemaiwo/UI5Con2019/tree/master/webapp/controller

(this is from one of the templates in Web IDE)

marie-pierre_mela
Product and Topic Expert
Product and Topic Expert
0 Kudos

It's working fine, when all .js are in the same folder. But not when in separate folders.

I'm trying to find the right resourceRoots as indicated by Florian