var designerModule = angular.module('designer');
angular.module('designer').requires.push('sfSelectors');
designerModule.controller('CustomCtrl',[ '$scope', 'propertyService', function ($scope, propertyService) {
$scope.feedback.showLoadingIndicator = true; propertyService.get().then(function (data) {
if (data) {
$scope.properties = propertyService.toAssociativeArray(data.Items);
}
},
function (data) {
$scope.feedback.showError = true; if (data) $scope.feedback.errorMessage = data.Detail;
}). finally (function () {
$scope.feedback.showLoadingIndicator = false;
});
$scope.$watch('properties.SelectedItems.PropertyValue', function (newValue, oldValue) {
if (newValue) {
$scope.selectedItems = JSON.parse(newValue);
}
});
$scope.$watch('selectedItems', function (newValue, oldValue) {
if (newValue) {
$scope.properties.SelectedItems.PropertyValue = JSON.stringify(newValue);
}
});
$scope.$watch('properties.SelectedIds.PropertyValue', function (newValue, oldValue) {
if (newValue) {
$scope.ids = JSON.parse(newValue);
}
});
$scope.$watch('ids', function (newValue, oldValue) {
if (newValue) {
$scope.properties.SelectedIds.PropertyValue = JSON.stringify(newValue);
}
});
}]);