<div *ngFor = "let val of values">{{val}} </div>
There are 3 values in values array. Each val is printing in different line. I want all 3 vals in the same line. How to do it?? Please help!!
Edit: even using span is giving the output in 3 lines
CodePudding user response:
use span
<span *ngFor = "let val of values">{{val}} </span>
CodePudding user response:
I guess it's caused by the fact that you are using the ngFor loop in a div, which is a block element. Block elements start with a new line. You can put ngFor on a line element like button, or you can change display to inline in styles.
<button *ngFor = "let val of values">{{val}} </button>
or
div {display: inline}
Try it