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,016

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
FlorianVogt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Marie-Piere,

The answer of c3d1947136cd4c748a7aa794001af496 is the first step. The recommendation is to name only the files which are directly controller of a view with .controller.js. So, in your case:

  • BaseController.js
  • MyController.controller.js

Also, you have to specify the resourceRoots in the index.html or manifest.json.

All the best!

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

Thanks Florian. Would you have any example how to use the resourceRoots in such case ? I din't manage to have it work