aurelia materilaize component md-chips close option

19 Views Asked by At

i have an array that looks as follows

`0: {tag: '[email protected]', __observers__: {…}} 

1: {tag: '[email protected]', __observers__: {…}} 

2: {tag: '[email protected]', __observers__: {…}} `

I am using md-chips from aurelia here

every time i close a single chip the chip next to it also gets closed.

this is my html

<md-chip repeat.for="tag of createTags" has-close="true" close.trigger="logClose(tag)"> ${tag.tag} </md-chip>

and ts

logClose(valueToRemove) {
if (!isNullOrUndefined(valueToRemove) || valueToRemove !== "") {
if (this.createTags.length > 0) {
this.createTags = this.createTags.filter(x => x.tag !== valueToRemove.tag);

            return this.createTags;
        }
    }

}

in the above function the filter removes it correctly from the array but on the front end when the html is displayed its showing that 2 tags are closed.

I only want the tag that i click to close and not close the tag next to it.

What am i doing wrong?

0

There are 0 best solutions below