Solution 1 :

it shouldn’t show <p> may be you have a <p> string in tagsArr
it work fine on my device

.ts

tagsArr = ['#tag1, #tag2, #tag3' ,'#tag4' ]

.html

<div *ngIf="tagsArr">
 <p>
  <span>Tags: </span>
 </p>
  <p *ngFor="let tag of tagsArr"> 
    <span> {{tag}}, </span>
  </p>
</div>

Problem :

i’m trying to show tags from user, (example when user write #name).
my code in html is this.

<div *ngIf="tagsArr" style="display: flex;">
 <p>
  <span>Tags: </span>
 </p>
 <p *ngFor="let tag of tagsArr"> 
   <span> {{tag}}, </span>
 </p>
</div>

This is the code. and the result is like:

Tags: #name ,#name ,#name < / p >,

(without space)

Why the end tag of </p>, is displayed there?

I want to display the Tags like:

Tags: #name, #name, #name

Comments

Comment posted by JSmith

if you see

By