[Addressability] Work around reload again

Work around Angular's page refresh on URL change to avoid
unintended effects when chosen view changes (such as tree
collapse), WTD-1149.
This commit is contained in:
Victor Woeltjen
2015-06-16 15:23:55 -07:00
parent d559dae1e2
commit 9942e24039
3 changed files with 15 additions and 6 deletions

View File

@ -31,7 +31,7 @@ define(
* object (the right-hand side of Browse mode.)
* @constructor
*/
function BrowseObjectController($scope, $location) {
function BrowseObjectController($scope, $location, $route) {
function setViewForDomainObject(domainObject) {
var locationViewKey = $location.search().view;
@ -48,8 +48,14 @@ define(
}
function updateQueryParam(viewKey) {
var unlisten, priorRoute = $route.current;
if (viewKey) {
$location.search('view', viewKey);
unlisten = $scope.$on('$locationChangeSuccess', function () {
$route.current = priorRoute;
unlisten();
});
}
}