Skip to content

Instantly share code, notes, and snippets.

@DavidVotrubec
Last active May 12, 2016 07:25
Show Gist options
  • Save DavidVotrubec/144c1667dc36100d9f27f91bcf199830 to your computer and use it in GitHub Desktop.
Save DavidVotrubec/144c1667dc36100d9f27f91bcf199830 to your computer and use it in GitHub Desktop.
Newline to <br/> in EmberJS
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