AngularJS ng-list 指令
AngularJS 教程
· 2019-04-01 19:58:36
AngularJS 实例
转换用户的输入为数组:
<div ng-app="">
<input ng-model="customers" ng-list/>
<pre>{{customers}}</pre>
<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 | 可选,定义分隔符,默认为", " |
点击查看所有 AngularJS 教程 文章: https://www.codercto.com/courses/l/36.html
The Effective Engineer
Edmond Lau / The Effective Bookshelf, Palo Alto, CA. / 2015-3-19 / USD 39.00
Introducing The Effective Engineer — the only book designed specifically for today's software engineers, based on extensive interviews with engineering leaders at top tech companies, and packed with h......一起来看看 《The Effective Engineer》 这本书的介绍吧!