I am working on a web application with two pages using AngularJS. Here is the JSON file I am using:
{
"data": [
{ "name": "bhav",
"id": 123
},
{"name": "bhavi",
"id": 1234
},
{"name": "bhavk",
"id": 1235
}
]
}
Here's my app.js (Routing file):
myApp = angular.module('myApp', ['slickCarousel',
'ngRoute',
'myAppControllers',
'myAppServices','swipeLi'
]);
myApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/home-page.html',
controller: 'ProfileListCtrl',
}).
when('/profile/:typeofprofile', {
templateUrl: 'partials/profile-detail.html',
controller: 'ProfileDetailCtrl'
})
}]);
The structure of my first page (home-page.html) is as follows:
<div ng-repeat="data in data">
<a href="profile/myfriend">{{data.name}}</a>
</div>
On the second page (profile-details.html), I need to retrieve the id number of that profile without passing it through the URL since I am fetching data from the JSON file using an http.get request in the controllers.
Please provide assistance on how to fetch the id or name of the clicked profile without passing it through the URL.
Note: I have already reviewed resources like this one: Angular ui router passing data between states without URL, but it did not address my specific issue.