This is a creation in Article, where the information may have evolved or changed.
1. Routing configuration for parent pages
. State (' Tab.article ', { URL: '/article ', nativetransitions: {type: ' fade ' }, views : {' tab-article ': { templateurl: ' templates/article/article.html ', controller: ' Articlecontroller '}} })
2. Routing configuration for sub-pages
. State (' Tab.article_details ', { URL: '/article_details?articledetailsurl ', views : {' tab-article ': { Templateurl: ' templates/article/article_details.html ', controller: ' Articledetailscontroller '}} )
3. Parent page Pass parameter procedure
/*** @param URL Path *///The following click event is placed in the parent page Controller $scope.itemclicked = function (URL) {//url is the parameter passed from the article.html page; The first parameter is the path to the route, the second parameter is the value assigned to the property, $state. Go (' tab.article_details ', {articledetailsurl:url});}
4. Parent page Pass parameter source
The following label is placed on the parent page <li ng-click= "itemclicked (URL)" > click Get url</li>
5. Sub-page Get parameters
The following JS is placed in the child page controller, the following can get the parent page passed over the URL var articledetailsurl = $stateParams. Articledetailsurl;
If the list page jumps to the detail page, passing too many parameters, you can also use this method to pass, using the JSON string to pass, to the target interface to parse it can be:
6. HTML for parent page (List page):
<ion-item ng-repeat= "Listdata in Listdatas ng-click=" Listdetailsclick (listdata) "></ion-item>
7. Controller for parent page (List page):
$scope. Listdetailsclick = function (listdata) { //Convert object to string var Listdataall = Angular.tojson (listdata); $state. Go ("ListDetails", {id:listdataall}); };
8. Controller for Sub-page (Detail page):
Converts a string to an object $scope.listdata = Angular.fromjson ($stateParams. ID);
9. Routing configuration:
. State (' ListDetails ', { URL: '/listdetails/:id ', templateurl: ' templates/list/listdetails/ Listdetails.html ', controller: ' Listdetailscontroller ' });
Note: In the actual process, you need to rely on injection $state, $stateParams and other services.