I am building a project which I have a bunch of profiles coming from an Array. One page displays them as a list, where each profile has a button to display more details about it.
The problem is that I don't know how to pass this specific object data to this another route. So I am wondering how it could be done. Any suggestions? Thank you
controller.js
var App = angular.module("App", ['ngRoute']);
App.config(function($routeProvider) {
$routeProvider
.when('/allprofiles', {
templateUrl : 'pages/all.profiles.html',
controller : 'allProfilesController'
})
.when('/profile/:id/', {
templateUrl : 'pages/profile.html',
controller: 'profileController'
})
.otherwise({redirectTo:'/allprofiles'});
});
App.factory('Allprofiles', function(){
return [
{name: "Adam", role: "Photographer", photo: "img/team/2.jpg", id:"1"},
{name: "John", role: "Musician", photo: "img/team/3.jpg", id:"2"},
{name: "Sam", role: "Actor", photo: "img/team/1.jpg", id:"3"},
{name: "Rachel", role: "Web Developer", photo: "img/team/3.jpg", id:"4"},
{name: "Joe", role: "Dancer", photo: "img/team/2.jpg", id:"5"},
{name: "Francis", role: "Psychology", photo: "img/team/1.jpg", id:"6"}
]
})
App.controller('allProfilesController', function($scope, $route, $location, Allprofiles) {
$scope.profiles = Allprofiles;
})
App.controller('profileController', function($scope, $route, $location) {
})