Skip to Content
author's profile photo Former Member
Former Member

Multi Component in SAPUI5

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2016 at 01:57 PM

    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
    
      });
    
    
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.