[Templates] Handle deferred selection availability

Loading templates via RequireJS text plugin means they are
immediately available; appears to have caused a change in
ordering wherein controllers for views may be initialized
before representers have installed things like selection
state. As such, need to watch for changes instead of simply
checking for a selection object when the controller is
initialized.
This commit is contained in:
Victor Woeltjen 2016-02-26 15:37:19 -08:00
parent 596735352a
commit 931fa77cbe

View File

@ -303,12 +303,16 @@ define(
this.generateDragHandles = generateDragHandles;
// Track current selection state
this.selection = $scope.selection;
$scope.$watch("selection", function (selection) {
this.selection = selection;
// Expose the view's selection proxy
if (this.selection) {
this.selection.proxy(new FixedProxy(addElement, $q, dialogService));
}
// Expose the view's selection proxy
if (this.selection) {
this.selection.proxy(
new FixedProxy(addElement, $q, dialogService)
);
}
}.bind(this));
// Refresh list of elements whenever model changes
$scope.$watch("model.modified", refreshElements);