cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Cannot set property '_oTargetHandler' of undefined sapui5

Former Member
0 Kudos

Dear Experts,

I am stuck in a SAP UI5 application that is throwing an error "Cannot set property '_oTargetHandler' of undefined". I am learning routing in SAPUI5.

Files Layout:

Please find the attached code.

code.txt

Thanks in Advance.

Regards,

Rachit.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Steve,

Can you please help me here. I am stuck in this issue.

Thanks.

Regards,

Rachit.

maheshpalavalli
Active Contributor
0 Kudos

The code you have written is based on old architecture, I would strongly recommend you to use the latest manifest file to store the routing information and use the component to load the manifest and instantiate the routing.

Moreover I've observed that you are calling "

sap.m.routing.RouteMatchedHandler"

,which is deprecated .


As i can see that you are already using the WebIDE, try to create a master detail application using the master detail template, which will generate 99% of the code to run your application with proper routing configuraiton, later on you can tweak your code.

Best Regards,

Mahesh

Former Member
0 Kudos

Hi Rachit

Try as follow.

in the code , the viewPath is not need because you have already written in the config section which is the default value for your targets.

And if you want to write it, you should not include the viewName in viewPath.

"target": {
					"master": {
						"viewName": "Master",
						"viewPath": "sapui5.demo.mvcapp.MVC1.webapp.view.Master",
						"viewType": "XML",
						"viewLevel": 1,
						"transition": "slide",
						"clearAggregation": "true"
					}
				}

Another thing is your controller code.

The controller code should write in controller of the Master view, not view App's controller.

Former Member
0 Kudos

Hi Steve,

Thanks for the response. I made the changes you suggested by I am still facing the same issue.

Regards,

Rachit.