We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3cb3f6e commit fcd8708Copy full SHA for fcd8708
src/ng/directive/input.js
@@ -887,7 +887,13 @@ var VALID_CLASS = 'ng-valid',
887
888
// Write data to the model
889
function read() {
890
- ngModel.$setViewValue(element.html());
+ var html = element.html();
891
+ // When we clear the content editable the browser leaves a <br> behind
892
+ // If strip-br attribute is provided then we strip this out
893
+ if( attrs.stripBr && html == '<br>' ) {
894
+ html = '';
895
+ }
896
+ ngModel.$setViewValue(html);
897
}
898
899
};
@@ -897,6 +903,7 @@ var VALID_CLASS = 'ng-valid',
903
<form name="myForm">
904
<div contenteditable
905
name="myWidget" ng-model="userContent"
906
+ strip-br="true"
900
907
required>Change me!</div>
901
908
<span ng-show="myForm.myWidget.$error.required">Required!</span>
902
909
<hr>
0 commit comments