Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9146

Application breaks when called as Component

$
0
0

So, I have this UI5 Application which works perfectly fine when called thru index.html, however it breaks (resources not found, failed to load,404 error etc) when I try to call it as Component. Both the applications (Caller & Callee) are on Gateway

 

Here is the application folder structure.

callee_app-Struct.jpg  

all the views are under zui5_trip_confirmation -> views folder..The images and models are in the respective folders.

 

The component.js is under the folder Component and is defined as

 

// define a new UIComponent
jQuery.sap.declare("components.Component");
jQuery.sap.require("sap.ui.core.UIComponent");
jQuery.sap.require("sap.ui.commons.Button");
jQuery.sap.require("sap.ui.table.Table");
//new Component
sap.ui.core.UIComponent.extend("components.Component", {    metadata : {        properties : {            text: "string"        }    }
});
components.Component.prototype.createContent = function(){
/* trying to register the path zui5_trip_confirmation where all the views are stored */
sap.ui.localResources("zui5_trip_confirmation");
// jQuery.sap.registerModulePath('zui5_trip_confirmation','/sap/bc/ui5_ui5/sap/zui5_trip_conf/zui5_trip_confirmation');    this.oView = sap.ui.jsview("idHome", "zui5_trip_confirmation.views.Home");     return this.oView; 
};

The caller application calls it as

jQuery.sap.registerModulePath('components','/sap/bc/ui5_ui5/sap/zui5_trip_conf/components');

var oComp1 = sap.ui.getCore().createComponent({
        name: "components",
        id: "Comp1",
        settings: {text: "Hello World"}
    });

 

    var oCompCont1 = new sap.ui.core.ComponentContainer("CompCont1", {
        component: oComp1
    });
    oCompCont1.placeAt("content");

 

When I run the caller application, I get resource not found errors on the console. Basically the Component is not able to resolve the path to the views/models/images.

 

What could be wrong here?

 

Regards

Sandip


Viewing all articles
Browse latest Browse all 9146

Trending Articles



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