Skip to content
Advertisement

How to join values in comma seprated string on checkbox checked Angular 8

I am passing values on checkbox chnages event in api.

I want to pass comma seprated values in URL on checkbox change like below example.

code=ABC,DEF,RED

and remove values on checkbox unchecked event like below example code=ABC,DEF

Can any one help me to do this.

Below is my code

JavaScript

Advertisement

Answer

Simple solution could be.

in component.ts file

JavaScript

In template

JavaScript

Working DEMO

Hope this solve your issue.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement