Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Error while using component.js

$
0
0

Hi,

I am trying to use component .During that i am facing an error in component.js file .Please help me to find the error.And suggest me to know more about component.js for a fresher in UI5

Please go through the code :

 

 

Error i am facing :

 

UIComponent.js:6 Uncaught TypeError: undefined is not a function

 

 

Index.html

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

 

<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

 

 

  <script src="resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

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

  data-sap-ui-theme="sap_bluecrystal"

  data-sap-ui-resourceroots='{

  "sap.ui.demo.myApp": "./"

  }'>

  </script>

  <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

 

 

  <script>

 

  new sap.ui.core.ComponentContainer({

  name : "sap.ui.demo.myApp"

  }).placeAt("content");

 

 

  </script>

 

 

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

 

 

 

component.js

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

 

jQuery.sap.declare("sap.ui.demo.myApp.Component");

 

 

sap.ui.core.UIComponent.extend("sap.ui.demo.myApp.Component",{

 

  createContent : function()

  {

 

  /*var oview = sap.ui.view({

  id : "app",

  viewName : "sap.ui.demo.myApp.view.App",

  type : "JS",

  viewData : { component : this }

  });*/

 

  var oView = sap.ui.view({

  id : "app",

  viewName : "sap.ui.demo.myApp.view.App",

  type : "JS",

  //viewData : { component : this }

  });

 

 

 

  //var omodel = new sap.ui.model.json.JSONModel("model\mock.json");

 

  //oView.setModel(omodel);

 

 

 

  return (oView);

 

  }

});

 

 

App.view

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

 

sap.ui.jsview("view.App", {

 

 

 

  getControllerName : function() {

  return "view.App";

  },

 

 

 

  createContent : function(oController) {

  var btn = new sap.m.Button({

  text : "Hii"

  });

 

  return btn;

 

  }

 

 

});


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>