Tag stats reflect changes in the tag list

This commit is contained in:
jendib 2013-08-12 21:32:16 +02:00
parent c37fb1d4ae
commit 305993e0f9

View File

@ -61,6 +61,13 @@ App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) {
* Update a tag. * Update a tag.
*/ */
$scope.updateTag = function(tag) { $scope.updateTag = function(tag) {
Restangular.one('tag', tag.id).post('', tag); // Update the server
Restangular.one('tag', tag.id).post('', tag).then(function () {
// Update the stat object
var stat = _.find($scope.stats, function (t) {
return tag.id == t.id;
});
_.extend(stat, tag);
});
}; };
}); });