Я пробовал что-то вроде этого, но получаю ошибку: TypeError: Cannot read property 'split' of undefined
var myApp = angular.module('myApp', ['ui.router'])
.filter('newlines', function(){
return function(text){
return text.split('\n');
};
})
Html:
<textarea class="form-control" rows="3" ng-model="numbers" ng-trim="true" placeholder="Numbers in one per line format" ng-repeat="n in numbers | newlines"></textarea>
Вам нужно получить значение split в массиве.
filter('newlines', function(){
return function(text){
var array=[];
array=text.split('\n');
return array[0] // or if u want second part array[1]
};
})
numbers
?