search

Home  >  Q&A  >  body text

html - How to wrap the string returned in angular filter

Adding n will not change the line, only a space will be displayed
For example, the last return "湖北n江苏"

in the filter
迷茫迷茫2757 days ago1667

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-15 17:08:10

    Reason: When HTML renders the page, multiple spaces or line breaks will be merged into one space and displayed on the page

    Solution:

    1. You can use the <pre></pre> tag when rendering the page and insert the returned string into this tag.

        pre 标签可定义预格式化的文本。被包围在 pre 标签中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体
      
    2. Use "<br/>" tag to replace line

    reply
    0
  • 高洛峰

    高洛峰2017-05-15 17:08:10

    Uh-huh. . The webpage does not recognize n.

    split("n") gets the new array, and then generates a new tag with <br/> insert it into a new line

    reply
    0
  • Cancelreply