I have a list of cookies that contain commas, and I want to remove a specific item when it is clicked. Here is an example of how my cookies are structured:
879273565,879269461,879273569,659234741
artistcontrollers.controller("CartController", ["$scope", "$http", "$cookies", "$cookieStore", function ($scope, $http, $cookies, $cookieStore){
var list = $cookies.get('basketlist');
console.log("Before removal "+list);
$scope.DeleteCookie = function (id){
console.log(id);
$cookies.remove(id);
console.log("After removal "+list);
}
}]);
In the HTML:
<a href="javascript:void(0);" class="addtocart_class btn btn-default" ng-click="DeleteCookie(cartlist.trackId)">Remove</a>
I need help figuring out how to remove items one by one when a particular item id is clicked.