The split function works just great with space as a delimiter, but i want to split with new line as the delimiter. I've tried
$scope.arr = $scope.cols.split('\n');
But it doesn't do the trick.
JS
var app = angular.module('app', []);
app.controller('ctrl', function ($scope) {
$scope.arr = [];
$scope.makeArray = function () {
$scope.arr=$scope.cols.split('\n');
console.log($scope.arr);
var parent = document.getElementById("div1");
var child = document.getElementById("inp");
parent.removeChild(child);
}
});
HTML
<div ng-controller="ctrl">
<div style="text-align:left;">
<input ng-model="cols" type="text" ng-change="makeArray()" />
<div ng-repeat="x in arr track by $index">
<input type="text" value={{x}}>
</div>
</div>
</div>