NG-清单,换行符在AngularJS&GT textarea的delimter 1.3 [英] ng-list with line break as textarea delimter in AngularJS >1.3

查看:266
本文介绍了NG-清单,换行符在AngularJS&GT textarea的delimter 1.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AngularJS 1.3凡NG-列表的语法也略有改变(例如,它不再支持正则表达式)

I'm using AngularJS 1.3 where the syntax for ng-list has changed slightly (for instance, it no longer supports regex)

我想指定一个换行符作为分隔符为NG-list的一个textarea。然而,它不能正常工作。我试着设置NG-列表为ASCII换行符

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.

如何正确指定换行符作为分隔符为NG-list的AngularJS 1.3?

How do I properly specify a line break as the delimiter for ng-list in AngularJS 1.3?

链接plunker: http://plnkr.co/edit/F37yA0LRHQXMh4caP3A0

Link to plunker: http://plnkr.co/edit/F37yA0LRHQXMh4caP3A0

推荐答案

我们应该使用 NG-修剪=FALSE 。见更新 plunker

 <textarea name="namesInput" 
 ng-list="&#10;"
 ng-model="names"
 ng-trim="false"
 required cols="40" rows="20"></textarea>

查看文档的 ngList (小举:)

如果 ngTrim 设置为假,那么周围的隔膜与各列表项的空白都得到尊重。这意味着该指令的用户是负责处理空白,也允许你使用空格作为分隔符,如制表符或换行符。

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.

这篇关于NG-清单,换行符在AngularJS&GT textarea的delimter 1.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆