我使用ngx-intl-tel-input,当绑定有模型时:
"phone":
{
"countryCode": "",
"dialCode": "",
"internationalNumber": "",
"nationalNumber": "",
"number": ""
}但我想要模型:
"phone":
{
"internationalNumber": ""
}我能做什么?
非常感谢!
发布于 2019-12-25 16:51:45
您可以将中间件变量用于绑定:
<ngx-intl-tel-input [(ngModel)]="mobile"> <ngx-intl-tel-input>例如:
let mobile;
let internationalNumber="";
internationalNumber=mobile.internationalNumber;现在你的绑定已经准备好了!
发布于 2020-02-12 20:25:16
[(ngModel)]实际上附带了事件绑定和属性绑定。下面两条线相等。
<input [ngModel]="yourVariable" (ngModelChange)="yourVariable = $event">和
<input [(ngModel)]="yourVariable">所以对于你的问题,你可以像下面这样做。
<input [ngModel]="yourVariable" (ngModelChange)="yourVariable = $event.internationalNumber">https://stackoverflow.com/questions/57946180
复制相似问题