From 7b9a886bebe328328337286e6b85f41fa0d8d59f Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 26 Aug 2015 16:31:02 -0700 Subject: [PATCH] [Inspector] Cleanup Some more undefined checking. Changed unnecissary scope variable into a regular one. --- .../src/controllers/ObjectInspectorController.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/general/src/controllers/ObjectInspectorController.js b/platform/commonUI/general/src/controllers/ObjectInspectorController.js index 5b04304af0..9a1410d3f9 100644 --- a/platform/commonUI/general/src/controllers/ObjectInspectorController.js +++ b/platform/commonUI/general/src/controllers/ObjectInspectorController.js @@ -38,11 +38,10 @@ define( function ObjectInspectorController($scope, objectService) { $scope.primaryParents = []; $scope.contextutalParents = []; - //$scope.isLink = false; // Gets an array of the contextual parents/anscestors of the selected object function getContextualPath() { - var currentObj = $scope.ngModel.selectedObject, + var currentObj = $scope.ngModel && $scope.ngModel.selectedObject, currentParent, parents = []; @@ -84,23 +83,23 @@ define( getPrimaryPath(next); }); } - } // Gets the metadata for the selected object function getMetadata() { - $scope.metadata = $scope.ngModel.selectedObject && + $scope.metadata = $scope.ngModel && $scope.ngModel.selectedObject && $scope.ngModel.selectedObject.hasCapability('metadata') && $scope.ngModel.selectedObject.useCapability('metadata'); } // Set scope variables when the selected object changes $scope.$watch('ngModel.selectedObject', function () { - $scope.isLink = $scope.ngModel.selectedObject && + var isLink = $scope && $scope.ngModel && + $scope.ngModel.selectedObject && $scope.ngModel.selectedObject.hasCapability('location') && $scope.ngModel.selectedObject.getCapability('location').isLink(); - if ($scope.isLink) { + if (isLink) { getPrimaryPath(); getContextualPath(); } else {