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

cannot access service from Component.js?

$
0
0

I created a sapui5 application and added northwind odata service in it.And in init method of component.js i wrote below code.Page is not loading what am i doing wrong.Iam using cloud trial version of sapwebide.Please help

 

var mConfig = this.getMetadata().getConfig();

  var sServiceUrl = mConfig.serviceConfig.serviceUrl;

  // Create and set domain model to the component

  var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, {

     json: true,

     loadMetadataAsync: true

  });

  oModel.attachMetadataFailed(function() {

     this.getEventBus().publish("Component", "MetadataFailed");

  }, this);

  this.setModel(oModel);

Regards


Viewing all articles
Browse latest Browse all 3599


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