英文:
How to place a custom placeholder in ngx-intl-tel-input before country selection
问题
需要在“ngx-intl-tel-input”中在选择国家代码和输入号码之前有一个占位符,类似于'Office Phone'。
尝试使用以下两个字段进行设置,但输入框仍然为空:
[enablePlaceholder]="true"
[customPlaceholder]="Office Phone"
目前正在使用Angular 12。如果有其他库可以实现所期望的结果,请提供建议。
英文:
Need to have a placeholder like 'Office Phone' in 'ngx-intl-tel-input' before the country code selection and number input happens
<form #f="ngForm" [formGroup]="phoneForm">
    <div class="wrapper">
      <ngx-intl-tel-input
        [cssClass]="'custom'"
        [enableAutoCountrySelect]="true"
        [enablePlaceholder]="true"
        [customPlaceholder]="Office Phone"
        [searchCountryFlag]="true"
        [searchCountryField]="[
          SearchCountryField.Iso2,
          SearchCountryField.Name
        ]"
        [selectFirstCountry]="false"
        [maxLength]="15"
        [phoneValidation]="true"
        [separateDialCode]="separateDialCode"
        [numberFormat]="PhoneNumberFormat.National"
        name="phone"
        formControlName="phone"
      >
      </ngx-intl-tel-input>
    </div>
  </form>
Trying to set it using below two fields but the still the input box looks empty
 [enablePlaceholder]="true"
 [customPlaceholder]="Office Phone"
Currently using Angular 12.Kindly suggest if any other library could give the desired result.
答案1
得分: 0
[enablePlaceholder]="true"
customPlaceholder="手机号码"
无属性绑定的占位符有效。
感谢
@Fazeel Ashraf
英文:
[enablePlaceholder]="true" 
customPlaceholder="Mobile Number"
Placeholder without the property binding works.
-
Credits to
@Fazeel Ashraf
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论