转换用户的输入为数组:
< div ng-app = "" > < input ng-model = "customers" ng-list/> < pre >{{customers}}</ pre > |
ng-list 指令将字符串转换为数组,并使用逗号分隔。
ng-list 指令还有另外一种转换方式,如果你有字符串数组希望在输入框中显示,你可以在 input 上使用 ng-list 指令。
ng-list 属性值定义了分隔符。
< element ng-list = "separator" ></ element > |
<input>, <select>, <textarea>, 和其他可编辑元素支持该指令。
值 | 描述 |
---|---|
separator | 可选,定义分隔符,默认为", " |
在线实例
字符集 & 工具
最新更新
站点信息
关注我们