Skip to Content
0
Former Member
Jan 19, 2015 at 10:59 PM

routing parameter not working

379 Views

Hello Everyone,

I am trying to send the data from one view to another using routing but when I am writing the code its not sending the parameters which I am defining in the navTo function below is the code which I am trying to use .

edit : function(evt){
                           sap.ui.core.UIComponent.getRouterFor(this).navTo("app",{id : "5"});
          }

as shown above I am trying to send the id to the view app but in the init method of app view I am not getting the argument id its showing as undefined.

below is the code for init method

sap.ui.core.UIComponent.getRouterFor(this).attachRouteMatched(function(oEvent){
            
             console.log(oEvent.getParameter("arguments").id);
             if(oEvent.getParameter("name") === "app"){
             var context = new sap.ui.model.Context(view.getModel(),oEvent.getParameter("arguments").id);
             alert(context+"hello");
             }
       },this);

when I am trying to run the above code its showing me as undefined in the alert box.

So can anyone help me out where I am making a mistake .

Thanks in advance,

Anshul D