cancel
Showing results for 
Search instead for 
Did you mean: 

Unncaught TypeError: Cannot read property 'initialize' of undefined

Former Member
0 Kudos
1,032

Hi experts, I'm facing the error showed below when loading my application, this application, is an simple navigation example, but I don't know What  I'm doing wrong.

My code is the follow:

Code of Component.js

init: function() {

  UIComponent.prototype.init.apply(this, arguments);

  this.getRouter().initialize();

  }

 

Code of Manifest.json (routing)

"routing": {

"config": {

"routerClass": "sap.m.routing.Router",

"viewType": "XML",

"viewPath": "Nav.view",

"controlId": "app",

"controlAggregation": "pages",
        "transition": "slide"

                                        },

"routes": [{

"pattern": "",
"name": "appHome",

"target": "home"

         }],
                             "targets": {
  "home": {
"viewName": "Home",
"viewLevel": 1
}
                           }

}

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you All by response, the problem was, controlId "App", it was not  set at rootview.

jmargieh
Advisor
Advisor
0 Kudos

Hi,

did you load RouteMatchedHandler / requiered js for Routing, before calling this.getRouter() ?

Jawad

Former Member
0 Kudos

Hi Jawad, I'm not loading this lib, I'm gonna check how it is used to apply in my routing.

Thanks.

Former Member
0 Kudos

For some reason the router is not getting initialized.

this.getRouter().initialize();

The error also says

"Missing Type for Model "routing".

Try following:

"viewPath": "Nav.view", Here try giving absolute path

Also, compare your manifest.json file with any standard example file and see if you find any differences.
Thanks,
VS