Fix: some dashboards get into infinite loop of watches

This commit is contained in:
Arik Fraimovich
2014-03-30 17:30:32 +03:00
parent 77f226e4a2
commit 0b093415ca

View File

@@ -31,14 +31,14 @@
'<div class="panel-heading">{name}' +
'</div></li>';
$scope.$watch('dashboard.widgets', function(widgets) {
$scope.$watch('dashboard.widgets && dashboard.widgets.length', function(widgets_length) {
$timeout(function() {
gridster.remove_all_widgets();
if (widgets && widgets.length) {
if ($scope.dashboard.widgets && $scope.dashboard.widgets.length) {
var layout = [];
_.each(widgets, function(row, rowIndex) {
_.each($scope.dashboard.widgets, function(row, rowIndex) {
_.each(row, function(widget, colIndex) {
layout.push({
id: widget.id,
@@ -58,7 +58,7 @@
});
}
});
}, true);
});
$scope.saveDashboard = function() {
$scope.saveInProgress = true;