How can I preserve new lines in an AngularJS partial?

前端 未结 4 1702
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 16:53

Within an AngularJS partial I am looping over a list of entries as follows:

4条回答
  •  情书的邮戳
    2020-12-02 17:08

    I make filters

    // filters js
    myApp.filter("nl2br", function($filter) {
     return function(data) {
       if (!data) return data;
       return data.replace(/\n\r?/g, '
    '); }; });

    then

    // view
    

提交回复
热议问题