Fix document add with tags (client)

This commit is contained in:
jendib 2013-07-31 23:12:25 +02:00
parent 03e164ea38
commit 3345f3def6

View File

@ -18,6 +18,10 @@ App.controller('DocumentEdit', function($scope, $q, $http, $state, $stateParams,
Restangular.one('document', $stateParams.id).get().then(function(data) { Restangular.one('document', $stateParams.id).get().then(function(data) {
$scope.document = data; $scope.document = data;
}); });
} else {
$scope.document = {
tags: []
};
} }
/** /**
@ -31,7 +35,7 @@ App.controller('DocumentEdit', function($scope, $q, $http, $state, $stateParams,
} }
// Extract ids from tags // Extract ids from tags
document.tags = _.pluck(document.tags, 'id'); document['tags[]'] = _.pluck(document.tags, 'id');
if ($scope.isEdit()) { if ($scope.isEdit()) {
promise = Restangular promise = Restangular