skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

Problem with passing parameters using Apperyio.get("$routeParams");

Problem with passing parameters using Apperyio.get("$routeParams");

I am attempting Appery AngularJS development without any knowledge, just by looking at examples.

I have 2 pages.

On page 1, I am displaying {{item.id}} in a listitem Text field. And ng-click is goTo(item.id).
In Scope goTo(id) I have this code:
alert(id);
Apperyio.navigateTo("page2",{'id':id});
I have confirmed in Routing that page2 path is /Page2.html

On page 2, init function I have this code:
var $routeParams = Apperyio.get("$routeParams");
var id = $routeParams['id'];
alert(id);
// change app's title on the index's header (for now display the id)
// display records from collection-page2 where id_page1 = id
When I test the app, I get my page 1 with the items listed, displaying the item.id. When I press the link an alert with the right item.id pops up. Then I am taken to page 2, but the alert does not display the same id (instead it says undefined).

What am I doing wrong?

Secondly, I would like to know how I can change the header of the app which is the index page's header component. When navigated to Page2 the header needs to change to id.

Hope I have given enough details concisely. Any help is much appreciated. Thanks!

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

Problem with passing parameters using Apperyio.get("$routeParams");

In Routing the page2 path needs to be changed to /Page2.html/:id

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

Problem with passing parameters using Apperyio.get("$routeParams");

I am still looking for answer to my 2nd part ..
Secondly, I would like to know how I can change the header of the app which is the index page's header component. When navigated to Page2 the header needs to change to id.

Thanks!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Problem with passing parameters using Apperyio.get("$routeParams");

Hello,

Please set it's value as a variable, e.g.: {{header.title}} and change that variable according to routeparams. More information here: https://blog.appery.io/2015/09/how-to...

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

Problem with passing parameters using Apperyio.get("$routeParams");

cool .. i will try .. thanks Sergiy!

skarun
Posts: 0
Joined: Fri Sep 18, 2015 2:23 am

Problem with passing parameters using Apperyio.get("$routeParams");

just fyi .. i have implemented the header as well. thanks Sergiy

Return to “Issues”