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


#1

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.


#2

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


#3

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


#4

Try something without be

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


#5

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


#6

< strong >something< /strong >

Maybe?


#7

Also use ion-label to encapsulate the texts


#8

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.