Ionic 4 line breaker

In Ionic 4, you can use the br tag to create a line break in your HTML template. Here are a few ways to do it:

  1. Using the br tag:

    <p>This is a paragraph of text.<br>This is another line of text.</p>
  2. Using the nl2br pipe:

    <p>{{ 'This is a paragraph of text.\nThis is another line of text.' | nl2br }}</p>

    The nl2br pipe converts newline characters (\n) to HTML line breaks (<br>).

  3. Using the newLine pipe:

    <p>{{ 'This is a paragraph of text.\nThis is another line of text.' | newLine }}</p>

    The newLine pipe converts newline characters (\n) to a line break.

  4. Using CSS:

    .line-break {
    white-space: pre-line;
    }

    Then, in your HTML:

    <p class="line-break">This is a paragraph of text.
    This is another line of text.</p>

    This method uses the white-space property to preserve newline characters and create a line break.

Note that in Ionic 4, you can also use the ionic-text directive to format text and create line breaks. For example:

<ion-text>
  This is a paragraph of text.
  <br>
  This is another line of text.
</ion-text>

This method is specific to Ionic and provides more advanced text formatting options.