Hi there, I'm trying to create chips with random colors from an array in my code. I attempted to use a color string array and assign them to the chips one after the other, but it didn't work as expected. Any suggestions on how I can achieve this?
HTML
<ion-chip [color]="color" class="chip" #chip *ngFor="let tag of tagName">
TS
public color: string [] = ["ok", "nice","awesome","danger","white"]
tagName
export class Tag {
tag: string;
constructor(value: Object = {}) {
Object.assign(this, value);
}
...
tagName: Tag[] = [];
...
add(): void {
let id = this.tagName.length + 1;
this.tagName.push(new Tag({ tag: "tag" + id }, ));
}
remove(tag: Tag) {
let id = this.tagName.indexOf(tag);
this.tagName.splice(id, 1);
}