I have a single string value like 15,16,17 and i want to convert it as ["15","16","17"] using angular js 1.x or java script.Please help me
My Angular js code is
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
Array items
<code style="display: block; padding: 8px;">{{selected | json}}</code>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.selected = [];
$scope.selected = ["15","16","17"];
$scope.existvalues=15,16,17;
//$scope.selected=$scope.existvalues;
/*Instead of above static code i want assign a comma separated string dynamic value like
this $scope.existvalues=15,16,17;
How i convert and assign $scope.existvalues to $scope.selected array like ["15","16","17"]
*/
});
</script>
</body>
</html>