You could use routeParams for this. Just add the id of the person to edit to the path and change your routes as follows:
.when('/list_persons/:personId', {
templateUrl: 'views/list_persons.html',
controller: 'topBarController',
activetab: 'list_persons'
})
Then, within your topBarController
, you can inject the $routeParams
-Service which will contain the personId:
[...].controller('topBarController', function($scope, $routeParams){
$scope.personId = $routeParams.personId;
}
If you have all your persons stored inside a Service or something, it gonna be easy to retrieve the person to edit just by the id.