'Required module missing methods

Is it a bug from UI5 (1.60.2) or I am doing something wrong here?

onSelectPreferredTreatment: function(event) {
  // ...
  const oDialog = new Dialog({/*...*/});
  oDialog.open();
},

VM77446:1 Uncaught TypeError: oDialog.open is not a function
at eval (eval at onSelectPreferredTreatment (Preview.controller.js?eval:NaN), :1:9)
at f.onSelectPreferredTreatment (Preview.controller.js?eval:552)

Full structure of oDialog



Solution 1:[1]

Check the dependency list in your controller. The order of the required modules should reflect the order of available parameters of the callback function exactly.

sap.ui.define([
  "sap/ui/core/mvc/Controller", // 1st
  "sap/m/Dialog", // 2nd
  // ...
], function(Controller/*1st*/, Dialog/*2nd, ...*/) {
  // ...
});

You might also have required some modules twice, similar to https://stackoverflow.com/a/55289688/5846045

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Boghyon Hoffmann