Skip to Content
0
Feb 28, 2021 at 08:03 AM

Showing me the Error : Uncaught TypeError: sap.ui.View is not a constructor

484 Views

**PLZ HELP ME ITS THROWING AN ERROR

** **index.html** -----------------------------------------------------------------

<!DOCTYPE html>

<html>

<head>

id="sap.ui.bootstrap"

data-sap-ui-libs="sap.m"

data-sap-ui-theme="sap_bluecrystal"

data-sap-ui-resourceroots='{"mario": "./"}' >

</script>

<script>

var oView = new sap.ui.View({ id:"Idmain",

viewName:"mario.view.Main",

type:"JS" })

oView.placeAt("sparta");

</script>

</head>

<body>

<div id="sparta"></div>

</body>

</html>

**Main.View.js**

----------------------------------------------------------------------

sap.ui.jsview("mario.view.Main",

{ getControllerName: function(){

return "mario.controller.Main";

},

createContent: function (oController) {

var oSpider = new sap.m.Button("idSpidy", {

text: "Button",

press: function(){

alert("you pressed the button");

}

});

return oSpider;

}

}

});

**Main.controller.js**

---------------------------------------------------

sap.ui.define([

"sap/ui/core/mvc/Controller"

],

function (Controller) {

"use strict";

return Controller.extend("mario.controller.Main",{

});

});