Within Angular, I need to generate a series of paragraph elements from a block of text containing newline characters?
I can think of a couple of ways to do this. Ho
The best solution I could think of was to create a filter:
angular.module('myApp').
filter('nlToArray', function() {
return function(text) {
return text.split('\n');
};
});
This takes a block of text and creates a new array element for each paragraph.
This array can then be plugged into an ng-repeat directive:
{{paragraph}}