Merge pull request #1352 from nasa/open1351

[Navigation] Fix errors appearing in console on application load
This commit is contained in:
Victor Woeltjen 2016-12-09 11:42:47 -08:00 committed by GitHub
commit a920220122

View File

@ -52,7 +52,7 @@ define(
var currentIds = $route.current.params.ids; var currentIds = $route.current.params.ids;
$scope.treeModel = { $scope.treeModel = {
selectedObject: {} selectedObject: undefined
}; };
function idsForObject(domainObject) { function idsForObject(domainObject) {
@ -139,7 +139,11 @@ define(
// Also listen for changes which come from the tree. Changes in // Also listen for changes which come from the tree. Changes in
// the tree will trigger a change in browse navigation state. // the tree will trigger a change in browse navigation state.
$scope.$watch("treeModel.selectedObject", navigateDirectlyToModel); $scope.$watch("treeModel.selectedObject", function (newObject, oldObject) {
if (oldObject !== newObject) {
navigateDirectlyToModel(newObject);
}
});
// Listen for route changes which are caused by browser events // Listen for route changes which are caused by browser events