Skip to Content
0

Uncaught TypeError: Cannot read property 'oTargetControl' of undefined

Sep 14, 2017 at 07:57 AM

358

avatar image
Former Member

Hi All:

When I am launching my SAPUI5 application , I am getting below mentioned error. It's failing in router initialization.

"Cannot read property 'oTargetControl' of undefined"

Please find the Screen shot of console for the same

15053752981.png

I'm using Routing configurations.

my component.js

sap.ui.define(["sap/ui/core/UIComponent",
	"sap/ui/Device",
	"sap/ui/model/json/JSONModel"], function (UIComponent, Device, JSONModel) {
	"use strict";


	var Component = UIComponent.extend("sap.fiori.team.info.HOME.Component", {
		metadata: {
			dependencies: {
				libs: [
					"sap.m",
					"sap.viz",
					"sap.ui.commons"
				]
			},
			includes:["../style.css"],
			routing : {
				"config" : {
					"resourceBundle" : "i18n/i18n.properties",
					"routerClass": "sap.m.routing.Router",
					"viewType": "XML",
					"viewPath": "sap.fiori.team.info.HOME",
					"controlId": "app",
					"controlAggregation": "pages",
					"transition":"slide",
					"bypassed":{
						"target":"KPIObjectPageHeader"
					}
				},
				"routes": [
					{
						"pattern": "",
						"name": "profile",
						"target": "profile"
					},
					{
						"pattern": "change",
						"name": "change",
						"target": "change"
					},
					{
						"pattern": "Membership",
						"name": "Membership",
						"target": "Membership"
					}
				],
				"targets": {
					"profile": {
						"viewPath": "sap.fiori.team.info.HOME",
						"viewName": "HomePage",
						"viewLevel": 0,
						"transition":"show"
					},
					"change": {
						"viewPath": "sap.fiori.team.info.HOME",
						"viewName": "KPIObjectPageHeader",
						"viewLevel": 1,
						"transition":"show"
					},
					"Membership":{
						"viewPath": "sap.fiori.team.info.HOME",
						"viewName": "MembershipCredentials",
						"viewLevel": 2,
						"transition":"show"
					}
				}
			}
		},
		init : function() {
		    sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
			this.getRouter().initialize();
		}


	});
	return Component;
}, true);

index.html

<!DOCTYPE HTML>
<html>


	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta charset="utf-8">


		<title>员工管理</title>


		<script id="sap-ui-bootstrap"
			src="/resources/sap-ui-core.js"
			data-sap-ui-libs="sap.m"
			data-sap-ui-theme="sap_bluecrystal"
			data-sap-ui-xx-bindingSyntax="complex"
			data-sap-ui-preload="async"
			data-sap-ui-compatVersion="edge" 
			data-sap-ui-resourceroots='{"sap.fiori.team.info.HOME": "./", "sap.ui.demo.mock": "mockdata"}'>
		</script>


		<!-- Application launch configuration -->
		<script>
			console.log(1);
			sap.ui.getCore().attachInit(function() {
				var oModel = new sap.ui.model.resource.ResourceModel({bundleUrl:"i18n/i18n.properties"});
				var i18nResource = oModel.getResourceBundle();
				var title = i18nResource.getText("title");
				new sap.m.App ("app",{
					pages: [
						new sap.m.Page({
							title: title, 
							enableScrolling : false,
							content: [ new sap.ui.core.ComponentContainer({
								height : "100%", name : "sap.fiori.team.info.HOME"
							})]
						})
					]
				}).placeAt("content");
			});
			console.log(1);
		</script>
	</head>
	<!-- UI Content -->
	<body class="sapUiBody" id="content" role="application">
	</body>


</html>


How do I fix this?

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

1 Answer

Iftah Peretz
Jan 26 at 02:07 PM
0

Hi,

I think the problem is in the controller. Please attch it.

Share
10 |10000 characters needed characters left characters exceeded