I'm very new in Angular and have a problem.
I have page with list of a items (some appointments).
AppointmentsSummary.chtml
<div class="border-section">
<table>
<thead>
...
</thead>
<tbody>
<tr ng-repeat="app in appts">
<td>
<a href="#/Appointments/AppointmentsSummary/MessageHistory/{{app.patientId}}">
<button type="button">Message history</button>
</a>
</td>
</tr>
</tbody>
</table>
</div>
And I have a controller for this template:
function AppointmentsSummaryController($scope, $location, AppointmentResource) {
console.log("loaded..");
$scope.appts = AppointmentResource.getAll({
.....(params)
});
}
When I clicked on the button "Message history" on the AppointmentsSummary.html - I relocate to page MessageHistiry.html, which has a "Back" button.
<a href="#/Appointments/AppointmentsSummary">
<button type="button">Back</button>
</a>
When I push this button, I return to list of appointments and AppointmentsControllerSummary reloaded and $scope.appts becomes null.
For routing between pages I uses $routeProvider (same with below)
$routeProvider.when(/Appointments/AppointmentsSummary/MessageHistory/:patientId', {
controller:'MessageHistoryController',
templateUrl:'Template/MessageHistory',
reloadOnSearch: false
Can I not reload this controller and save my $scope data?