在ngTable单元格中使用分隔符

时间:2017-02-06 16:30:04

标签: javascript html css delimiter ngtable

我目前正在使用ngTable构建一个显示电子邮件列表的表格。我想使用分号作为分隔符为单元格内的每个电子邮件创建一个新行。什么是最好的方法来解决这个问题?

Current: 
    Id     Email
    1      group@example.com
    2      group1@example.com;group2@example.com;group3@example.com
    3      group22@example.com

Goal is to get: 
    Id     Email
    1      group@example.com
    2      group1@example.com
           group2@example.com
           group3@example.com
    3      group22@example.com

http://jsfiddle.net/781qkzq0/38/

1 个答案:

答案 0 :(得分:1)

您可以使用white-space:pre为td设置样式,将电子邮件拆分为;并加入
(换行);

<td data-title="'Email'" style="white-space:pre">{{row.group_email.split(";").join("&#10;")}}</td>

updated fiddle