<tr ng-if="usernames.length" ng-repeat="user in usernames">
<td><input type="radio" name="radio" ng-model="form.currentPatient" value="{{user}}" id="{{user.id}}"></td>
<td>{{user.firstname}} </td>
<td>{{user.lastname}}</td>
<td>{{user.address}}</td>
<td>{{user.age}}</td>
</tr>
</table>
<div>{{form.currentPatient}}</div>
<button type="submit" value="View Profile" onclick="location.href('result.html' )">View Profile</button>
Если я нажму на этот переключатель, соответствующие значения json должны быть перенаправлены на страницу результатов. Пожалуйста, помогите мне......
Если не использовать маршрутизатор
Вы можете создать общий сервис или фабрику, чтобы хранить значение и извлекать его на другие страницы.
Если вы используете маршрутизатор
Вы можете привязать значение JSON в URl к этому way-:
window.location="#/result/firstname="+$scope.user.firstname+"&&lastname="+$scope.user.lastname+"&&age="+$scope.user.age; And You can access this value as $location.search()['firstname'], $location.search()['lastname'], $location.search()['age']
вы можете получить доступ к этому значению as-:
$ location.search() ['firstname'] для имени,
$ location.search() ['lastname'] для имени и
$ location.search() ['age'] для возраста
вы можете добавить $ location в функцию как $ scope.
ngRoute
илиui-route