I'am looking for the following possibility:
$stateProvider.state('user', angularAMD.route({
url: '/user/:id',
templateUrl: 'views/user.html',
controllerUrl: 'views/user',
controller: 'UserCtrl',
onExit: function () {
alert ("exit user");
// call scope function saveCurrentStateData();
}
}));
saveCurrentStateData() stores some scope data (e.g. $scope.my.data) via a defined REST-Service at the backend.
EDIT: Can you give me a solution without $scope.$on ('destroy',..
maybe with resolve property of ui-router ? Why can't I use onExit
, why it is here?