cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Reuse Application - Routing not working

martinkoch
SAP Champion
SAP Champion
0 Kudos
497

Hi,

i've checked various blogs and discussions on reusability of UIComponents.

I have created two Apps, both running fine when running standalone. Both are using routing. The router is initialized in the init function of the UIComponent.

I have the requirement that the second app is embedded into the first app. I did the embedding with the ComponentContainer.

var oComponent = sap.ui.getCore().createComponent({
    name: "com.abcd.reuse.ZSD_DETAIL",
    settings: {
	componentData: {
	     startupParameters: oStartupParameters
	}
    }
});
				
new sap.ui.core.ComponentContainer({
    component: oComponent
}).placeAt("content");

In the second view i have a rootView hosting the empty sap.m.App. The default route is pointing to a view named Main.view.xml with a corresponding controller. My problem is, that the default view is not loaded from the embedded App. It seems that it is a problem with the router, but I am not sure. Maybe i did something wrong when embedding the app. But if i remove routing from the second app an add a page directly to the rootView it shows up as expected.

Do you have any idea on this? Am i missing something ?

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
SAP Champion
SAP Champion
0 Kudos

do you have #*** in the url when the second app is embedded?

your second is app also trying to respond to that #*** but it is not suppose to ....which cause the issue.

martinkoch
SAP Champion
SAP Champion
0 Kudos

Thanks for your answer. Yes I have the # in the URL. How can i avoid / solve this ?

BR,

Martin

former_member365727
Active Contributor
0 Kudos

just a thought...when you say two Applications I assume that you have two manifest.json files...and when the component is loaded corresponding manifest.json file is loaded.

Check this blog for reusing components https://blogs.sap.com/2017/04/05/sapui5-how-to-reuse-parts-of-a-sapui5-application-in-othermultiple-...

martinkoch
SAP Champion
SAP Champion
0 Kudos

Hi,

i've tried to follow this blog, everything works when no routing is used. I am running on 7.5 ABAP with the latest SPS and the latest UI5 Version.

Br,

Martin