Page 1 of 1

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

Posted: Sun Feb 14, 2016 10:08 am
by skarun

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!


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

Posted: Mon Feb 15, 2016 2:55 am
by skarun

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


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

Posted: Mon Feb 15, 2016 8:43 am
by skarun

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!


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

Posted: Mon Feb 15, 2016 8:52 am
by Serhii Kulibaba

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...


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

Posted: Mon Feb 15, 2016 8:59 am
by skarun

cool .. i will try .. thanks Sergiy!


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

Posted: Tue Feb 16, 2016 7:43 am
by skarun

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