Skip to content

Commit

Permalink
Merge pull request #1257 from JoelParke/master
Browse files Browse the repository at this point in the history
Fix(taBind): Corrected issue around model becomes empty Issue #1230
  • Loading branch information
JoelParke authored Jul 29, 2016
2 parents 3870b5c + 6e0fb14 commit 17b4497
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ textAngular.directive("textAngular", [
'ng-model-options': element.attr('ng-model-options')
});
scope.displayElements.scrollWindow.attr({'ng-hide': 'showHtml'});
if(attrs.taDefaultWrap) scope.displayElements.text.attr('ta-default-wrap', attrs.taDefaultWrap);
if(attrs.taDefaultWrap) {
// taDefaultWrap is only applied to the text and the not the html view
scope.displayElements.text.attr('ta-default-wrap', attrs.taDefaultWrap);
}

if(attrs.taUnsafeSanitizer){
scope.displayElements.text.attr('ta-unsafe-sanitizer', attrs.taUnsafeSanitizer);
Expand Down
5 changes: 3 additions & 2 deletions src/taBind.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'])
.service('_taBlankTest', [function(){
var INLINETAGS_NONBLANK = /<(a|abbr|acronym|bdi|bdo|big|cite|code|del|dfn|img|ins|kbd|label|map|mark|q|ruby|rp|rt|s|samp|time|tt|var)[^>]*(>|$)/i;
var INLINETAGS_NONBLANK = /<(a|abbr|acronym|bdi|bdo|big|cite|code|del|dfn|img|ins|kbd|label|map|mark|q|ruby|rp|rt|s|samp|time|tt|var|table)[^>]*(>|$)/i;
return function(_defaultTest){
return function(_blankVal){
if(!_blankVal) return true;
Expand Down Expand Up @@ -189,7 +189,7 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
for(i = 0; i < _children.length; i++){
var node = _children[i];
var nodeName = node.nodeName.toLowerCase();
//console.log(nodeName);
//console.log('node#:', i, 'name:', nodeName);
if(nodeName === '#comment') {
value += '<!--' + node.nodeValue + '-->';
} else if(nodeName === '#text') {
Expand All @@ -213,6 +213,7 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
} else {
value += node.outerHTML;
}
//console.log(value);
}
}
}
Expand Down

0 comments on commit 17b4497

Please sign in to comment.