Commit 1bfc2a4f authored by gergely-ujvari's avatar gergely-ujvari

Merge pull request #1489 from hypothesis/delete-empty-tag

Fix error when pressing delete in empty tag field
parents ea74bd2e 64d33aba
......@@ -226,8 +226,9 @@ annotation = ['$filter', '$parse', 'annotator', ($filter, $parse, annotator) ->
scope.model.tags.push(tag.text)
scope.removeTag = (tag) ->
scope.model.tags = scope.model.tags.filter((t) -> t isnt tag.text)
delete scope.model.tags if scope.model.tags.length is 0
if tag and scope.model.tags
scope.model.tags = scope.model.tags.filter((t) -> t isnt tag.text)
delete scope.model.tags if scope.model.tags.length is 0
# Watch for changes
scope.$watch 'model', (model) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment