I have a certain doc editor where user can edit existing docs or create new
ones. An existing doc is accessed at URI:
/docs/1 (where 1 is doc id)
when user clicks 'create new doc' she lands on '/docs/new'.
At some point during edit of a new doc an ajax 'save' is triggered and the
response contains new doc id. consequently, I'd like to update the browser
location bar to show this id:
/docs/new --> /docs/1
...without a route update or re-instantiation of DocEditorCtrl or
repainting the ng-view - so that user's editing is not interrupted.
I tried the following in DocEditorCtrl:
$scope.$on('$routeChangeStart',function(evt){
if($scope.blockRouteChange){
evt.preventDefault();
$scope.blockRouteChange = false;
}
});
$scope.onSave = function(docId)
{
$scope.blockRouteChange = true;
$location.path('/docs/'+docId);
};
...but the controller is re-instantiated. *Is there a way to accomplish the
above?*
thanks,
-nikita
PS. I am aware that i can use reloadOnSearch=false with $routeProvider, but
would prefer to keep docId as part of URI path rather than of query params.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.