Last active
May 12, 2016 07:25
-
-
Save DavidVotrubec/144c1667dc36100d9f27f91bcf199830 to your computer and use it in GitHub Desktop.
Newline to <br/> in EmberJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nl2br(str) { | |
var newStr = str.split('\n').map(function(item) { | |
const key = Math.random() * (9999999 - 1) + 1; | |
return ( | |
<span key={key}> | |
{item} | |
<br/> | |
</span> | |
) | |
}); | |
return newStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment