如何在组件 ngx-intl-tel-input 中设置掩码
How to set a mask in component ngx-intl-tel-input
如何根据ngx-intl-tel-input组件的placeholder属性呈现的格式为phone号码定义掩码?
我找到了适合我的解决方案。我的 ngx-intl-tel-input 组件是一个 angular formControl。所以,我使用这个 formControl 的 valueChanges 事件来应用一个掩码:
ngOnInit() {
this.confirmForm = this.formBuilder.group({
cellPhone: [{ number: this.currentUser.number, countryCode: this.currentUser.countryCode }, [Validators.required]],
code: ['', [Validators.required, Validators.minLength(6)]],
id: [this.currentUser.id]
});
this.confirmForm.get("cellPhone").valueChanges.subscribe(x => {
//aply the mask
})}
如何根据ngx-intl-tel-input组件的placeholder属性呈现的格式为phone号码定义掩码?
我找到了适合我的解决方案。我的 ngx-intl-tel-input 组件是一个 angular formControl。所以,我使用这个 formControl 的 valueChanges 事件来应用一个掩码:
ngOnInit() {
this.confirmForm = this.formBuilder.group({
cellPhone: [{ number: this.currentUser.number, countryCode: this.currentUser.countryCode }, [Validators.required]],
code: ['', [Validators.required, Validators.minLength(6)]],
id: [this.currentUser.id]
});
this.confirmForm.get("cellPhone").valueChanges.subscribe(x => {
//aply the mask
})}