I created a method that appends a string if a checkbox is checked, and if not checked, it should remove the value from the string using the replace() method
The code for the method:
current_search : string = "";
generateLink(e, n) {
if(e.checked){
this.current_search = this.current_search + " " + n + ",";
console.log(this.current_search);
} else {
this.current_search.replace(n, '');
console.log(this.current_search);
}
}
Nothing gets updated on the string when the checkbox is unchecked. When it is checked, the string is appended with whatever 'n' is as that is being passed into the method.