Inside my Angular 2 component class, I have an array named myArray:
@Component({
templateUrl: 'my.component.html'
})
export class MyComponent {
private myArray: Array<string>;
...
}
The corresponding HTML file my.component.html contains a single input element:
<input placeholder='write some tags' value=''>
I want to populate the value attribute of the input element with the string elements from myArray, separated by commas. For example:
<input placeholder='write some tags' value='apple, orange, banana'>
I initially tried using *ngFor directive within the value attribute like this:
<input name='user-tag' placeholder='write some tags' value='*ngFor="let e of myArray"{{e}}'>
However, this approach resulted in an error. How can I achieve the desired outcome?