mercredi 3 février 2016

Angularjs concatenate string with multi-checkbox

I'm trying to refresh and concatenate a string when multiple checkboxes is checked.

For example, when 'apple' and 'banana' are checked, $scope.string should be ='ab', then when 'banana' is unchecked, $scope.string should be left with 'a'.

What I did does concatenate, however $scope.string won't remove old values, it is still ='aba'

Here is my attempt on JsFiddle.

You can see when all checkboxes are checked it gives me aababcabcd

Thanks




Aucun commentaire:

Enregistrer un commentaire