cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Component in SAPUI5

Former Member
0 Kudos

Dear All,

I am sure that SAPUI5 supports multi Component in SAPUI5. But I am not able to demonstrate practically.

What I have done is:

1) Created a SAPUI5 Application with a Component code as :


jQuery.sap.declare("test.Component");

sap.ui.core.UIComponent.extend("test.Component",{

  createContent : function(){

// this.oButton = new sap.m.Button()

  return new sap.m.Button({text:"login"})

  },

   myButton : function(){

    return new sap.m.Button({text:"login"});

   }

})

It works fine as individual Application, now I have created another SAPUI5 Application and created a component code as:-


jQuery.sap.declare("test2.Component");

jQuery.sap.registerModulePath("test", "")

jQuery.sap.require("test.Component");

sap.ui.core.UIComponent.extend("test2.Component",{

  createContent : function(){

  return test.Component.myButton();

  },

})

I am blur at what to define at line no 2 : jQuery.sap.registerModulePath("test", "<what to define here>");

both applications are deployed to the same server.

Please advice.

Regards,

Devender

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Achieved.

We need to create an instance of Component where we are calling (inside calling component)


var ocomp1 = sap.ui.getCore().createComponent({

  name : "test", // name of the component from it's declaration part

  url : "/sap/bc/ui5_ui5/sap/z_comp1" // path if the BSP Application

  });

Former Member
0 Kudos

Hi Devender,

Did you try to access this in eclipse instead of testing and pointing to bsp application in your server.

Because i am unable to access component of application 2 in application 1.

I have a application called "dealapp" and component name is sap.deal and maintained resource roots as "sap.deal": "../../dealapp", in index.html of application 1. I checked in network tab of application 1, it is calling to http://localhost:51169/dealapp/Component.js  with 404 error.

Can you help me!!!

Thanks,

Ramesh

Answers (0)