0
我是新手前端开发人员,我试图找出利用每个逗号后都有一个新行的文本区域的最佳方法。我真的试图找出最好的办法是在AngularJs什么(过滤器,正则表达式等)Textarea以逗号后的新行Angularjs
现在:
hello,how,are,you
后:
Hello
how
are
you
当前:
<textarea cols="105" rows="30" disabled="true"
style="background-color: floralwhite; resize: none; white-space: normal; margin-top: 0px; border: none;">
{{profile.exampleValues}}
</textarea>
我试着写,没有运气的过滤器:
.filter('newlines', function() {
return function (text) {
return text.replace(',', '<br/>');
}
})
新行是'\ n','
'是一个HTML标记。 –