Fixes tags property editor to not submit the html form when pressing enter.

This commit is contained in:
Shannon
2013-11-21 12:16:26 +11:00
parent 874c7977c2
commit d8862c85bf
2 changed files with 5 additions and 1 deletions

View File

@@ -11,6 +11,10 @@ angular.module("umbraco")
$scope.addTag = function(e) {
var code = e.keyCode || e.which;
if (code == 13) { //Enter keycode
//this is required, otherwise the html form will attempt to submit.
e.preventDefault();
if ($scope.currentTags.indexOf($scope.tagToAdd) < 0) {
$scope.currentTags.push($scope.tagToAdd);
}

View File

@@ -2,7 +2,7 @@
<span ng-repeat="tag in currentTags" ng-click="removeTag(tag)" class="label label-primary tag">{{tag}} <i class="icon icon-delete"></i></span>
<input type="text"
ng-keyup="addTag($event)"
ng-keydown="addTag($event)"
placeholder="Type to add tags.."
ng-model="tagToAdd" />
</div>