I'm using AngularJS 1.3 where the syntax for ng-list has changed slightly (for instance, it no longer supports regex)
I'm trying to specify a line break as the delimiter for ng-list in a textarea. However it doesn't work properly. I've tried to set ng-list to ASCII line break
but then there is a problem. At once when the contents are edited (i.e. add one character to the textarea contents), it starts to break on every single character.
How do I properly specify a line break as the delimiter for ng-list in AngularJS 1.3?
Link to plunker: http://plnkr.co/edit/F37yA0LRHQXMh4caP3A0
We should use ng-trim="false"
. See updated plunker
<textarea name="namesInput"
ng-list=" "
ng-model="names"
ng-trim="false"
required cols="40" rows="20"></textarea>
See the doc ngList (small cite:)
If ngTrim is set to "false" then whitespace around both the separator and each list item is respected. This implies that the user of the directive is responsible for dealing with whitespace but also allows you to use whitespace as a delimiter, such as a tab or newline character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With