Skip to content

Commit

Permalink
Merge pull request ziahamza#344 from kuoruan/fix_replace
Browse files Browse the repository at this point in the history
Fix "Cannot read property 'replace' of undefined"
  • Loading branch information
ziahamza authored May 8, 2017
2 parents ec53ee6 + f6793e5 commit a7a7cb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/directives/textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ webui.directive("textarea", function() {
link: function(scope, element) {
element.attr(
"placeholder",
element.attr("placeholder").replace(/\\n/g, "\n")
function(index, placeholder) {
if (placeholder !== undefined) {
return placeholder.replace(/\\n/g, "\n");
} else {
return placeholder;
}
}
).bind("keydown keypress", function(event) {
if (event.ctrlKey && event.which === 13) {
event.preventDefault();
Expand Down

0 comments on commit a7a7cb3

Please sign in to comment.