Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3441

Issue with component.js

$
0
0

Hello

 

I am following tutorial (Step 9: Component Configuration) for configuring components. followed exact steps but still the application does not load with error component not found.

 

Actually In eclipse when I create SAP UI5 project I dont get webapp folder and have Web Content folder there. Does that make a difference? I even tried downloading source code from Explored app and apply to my SAP UI5 project but now cannot even run it in WebApp Preview to see the console for errors. It simply says "Cannot open Web Application Preview".  This again works fine in SAP WebIDE but not eclipse.

 

Component.js

sap.ui.define([

  "sap/ui/core/UIComponent",

  "sap/ui/model/json/JSONModel",

  "sap/ui/model/resource/ResourceModel"

], function (UIComponent, JSONModel, ResourceModel) {

  "use strict";

 

 

  return UIComponent.extend("sap.ui.demo.wt.Component", {

 

 

  metadata : {

  rootView: "sap.ui.demo.wt.view.App"

  },

 

 

  init : function () {

  // call the init function of the parent

  UIComponent.prototype.init.apply(this, arguments);

 

 

  // set data model

  var oData = {

  recipient : {

  name : "World"

  }

  };

  var oModel = new JSONModel(oData);

  this.setModel(oModel);

 

 

  // set i18n model

  var i18nModel = new ResourceModel({

  bundleName : "sap.ui.demo.wt.i18n.i18n"

  });

  this.setModel(i18nModel, "i18n");

  }

  });

 

 

});

 

index.html

<!DOCTYPE html>

<html>

<head>

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

  <meta charset="utf-8">

  <title>SAPUI5 Walkthrough</title>

  <script

  id="sap-ui-bootstrap"

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

  data-sap-ui-theme="sap_bluecrystal"

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

  data-sap-ui-compatVersion="edge"

  data-sap-ui-preload="async"

  data-sap-ui-resourceroots='{

  "sap.ui.demo.wt": "./"

  }'>

  </script>

  <script>

  sap.ui.getCore().attachInit(function () {

  new sap.ui.core.ComponentContainer({

  name: "sap.ui.demo.wt"

  }).placeAt("content");

  });

  </script>

</head>

<body class="sapUiBody" id="content">

</body>

</html>


Viewing all articles
Browse latest Browse all 3441

Trending Articles



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