Skip to Content
0

Routing and Navigation problem Fiori - Eclipse

Feb 09, 2017 at 09:13 AM

138

avatar image

Hi, I'm trying to create a full app in fiori with Eclipse.

I have some problem with routing. Initially I put my router and path inside index, and in this case I hadn't problem.

After, how Sap reccomended, I devided functionality, and I created other two files: manifest.json and Component.js.
Where I wrong?
Thanks in advanced

This is my index:

<!DOCTYPE HTML>
<html>
    <head>
	 <meta http-equiv="X-UA-Compatible" content="IE=edge">
	 <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
		<script src="resources/sap-ui-core.js"
				id="sap-ui-bootstrap"
				data-sap-ui-libs="sap.m"
				data-sap-ui-theme="sap_bluecrystal"
				data-sap-ui-compatVersion="edge"
				data-sap-ui-preload="async"
				data-sap-ui-resourceroots='{
				"Routing": "./" }'>
		</script>
<!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->


		<script>
		        sap.ui.getCore().attachInit(function(){
		        	new sap.m.Shell({
		        		app: new sap.ui.core.ComponentContainer({
		        			height : "100%",
		        			name : "Routing"
		        	})
		        }).placeAt("content");
		        });		        			
		</script>
	</head>
	<body class="sapUiBody" role="application">
		<div id="content"></div>
	</body>
</html>

This is the Component:

sap.ui.define([
	"sap/ui/core/UIComponent"
], function (UIComponent) {
	"use strict";
	return UIComponent.extend("Routing.Component", {
		metadata: {
			manifest: "json"
		},
		init: function () {
			// call the init function of the parent
			UIComponent.prototype.init.apply(this, arguments);
			// router.register("appRouter");
			// create the views based on the url/hash
			this.getRouter().initialize();
		}
	});
});

This is the Manifest:

{
	"_version": "1.1.0",
	"sap.app": {
		"_version": "1.1.0",
		"id": "Routing", 
		"type": "application",
		"i18n": "i18n/i18n.properties",
		"title": "{{routingnavigation2}}",
		"description": "{{appDescription}}",
		"applicationVersion": {
			"version": "1.0.0"
		}
	},
	"sap.ui": {
		"_version": "1.1.0",
		"technology": "UI5",
		"deviceTypes": {
			"desktop": true,
			"tablet": true,
			"phone": true
		},
		"supportedThemes": ["sap_bluecrystal"]
  	},
	"sap.ui5": {
		"_version": "1.1.0",
		"rootView": {
		    "viewName": "Routing.view.main",
		    "type": "XML"
		    # "id": "home"
		    },
		"dependencies": {
			"minUI5Version": "1.30",
			"libs": {
				"sap.ui.core": {},
				"sap.m": {},
				"sap.ui.layout": {},
				"sap.ushell": {}
			}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		},
		"models": {
		     "i18n": {
			 "type": "sap.ui.model.resource.ResourceModel",
			 "settings": {
				"bundleName": "Routing.i18n.i18n.properties"
				}
			}
		},
		"routing": {
			"config": {
			     "RoutingClass": "sap.m.routing.Routing",
			     "viewType": "XML",
			     "viewPath": "Routing.routingnavigation.view",
				"controlId": "appId",
				"targetAggregation": "pages"
			},
			"routes": [{
				"pattern": "",
				"name": "view1",
				"viewName" : "view.view1",
				"targetAggregation": "pages"
			},
			{
			"pattern": "view2",
				"name": "view2",
				"viewName" : "view.view2",
				"targetAggregation": "pages"
			}]
		},
	}
}

This the image of the error:

error2.png (49.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers