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!