I have a simple case of pushing unique values into array. It looks like this:
this.items = []; add(item) { if(this.items.indexOf(item) > -1) {
You have to use === -1, if it equals to -1 i.e. item is not available in your array:
this.items = []; add(item) { if(this.items.indexOf(item) === -1) { this.items.push(item); console.log(this.items); } }