Skip to Content
0

SAPUI5 Reuse Application - Routing not working

Jul 27, 2017 at 08:46 AM

94

avatar image

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 ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Srikanth KV Jul 27, 2017 at 05:12 PM
0

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-sapui5-applications/

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Jun Wu Jul 29, 2017 at 12:37 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

BR,

Martin

0