angular7 - 如何在 ngModel 中获取 ngx-chips 值?
问题描述
我已经在电子邮件地址字段中实现了 ngx-chips。它运作良好。但是,当我在 component.ts 中输出值时,我只得到第一个芯片的值。如何获得所有筹码的价值?
如果我在 html 中有 a@xyz.com 和 b@xyz.com,则 ngModel 中只有 a@xyz.com。
组件.html
<div class="form-row">
<div class="required form-group col-md-12 col-sm-12 col-xs-12" >
<label class="control-label" for="email.emailCc">CC:</label>
<tag-input [ngModel]="[email.emailCc]" theme='bootstrap'>
<tag-input-dropdown [autocompleteObservable]="items" [showDropdownIfEmpty]="true" [dynamicUpdate]="false"></tag-input-dropdown>
</tag-input>
</div>
</div>
<div class="form-group col-md-12 col-sm-12 col-xs-12">
<button (click)="sendEmail()" class="btn btn-lg btn-primary btn-block">Send</button>
</div>
组件.ts
public items = (text: string): Observable<Response> => {
return this.sendEmailService.getEmailList(text);
};
sendEmail(){
console.log("email cc:"+this.email.emailCc);
}
输出
email cc:a@xyz.com
解决方案
推荐阅读
- macos - 使用 sed 执行递归查找和替换仅更改第一个文件
- python - 复制不在行开头的两个字符串之间的所有行-python
- reactjs - React 输出不保留换行符
- python - 使用 imap 获取电子邮件附件,但无论电子邮件是从 Outlook 客户端发送还是通过 Web 发送,都会得到不同的结果
- swift - 为什么 NSCoding 无法在正确保存后解码对象?
- postgresql - PostgreSQL - 如何创建一个跟随行号的自动增量函数?
- django - 无法识别我的 serializers.py 文件中的问题
- python - Keras Tuner build_model 和 run_trial 需要相同的参数
- haskell - 案例陈述中的haskell部分应用
- python - 显示对特定博客文章唯一的评论