<br> tag does not work in <ion-item>

Hi everyone!
I’m learning ionic 4 and I have a question. I have a list of movies and want to use ion-list to show the list. A movie has a title, a publishing year and some other attributes. I want to show the title and the publishing year in like:

<ion-item *ngFor="let movie of movies">
     <b>{{movie.Title}}</b> <br /> {{movie.Year}}
</ion-item>

but the
tag doesn’t have any effect.

What did I do wrong?

Best regards.

1 Like

working for me could you check: https://stackblitz.com/edit/ionic-qeyzfj

Hi, I don’t think you are using ionic 4.

Try something without be

Like for example How to add styles to ion-button inner text?

Thank you, the <b> tag is the problem. The <br/> tag works without <b> tag.

< strong >something< /strong >

Maybe?

Also use ion-label to encapsulate the texts

I tried with <strong>, it doesn’t work too. But I know a solution. I have to put the code in <div> tag, then everything is fine.

<ion-item *ngFor="let movie of movies">
      <div><b>{{movie.Title}}</b><br/>{{movie.Year}}</div>
 </ion-item>

Thank you for your help.

2 Likes