用于占位符标签文本的

用于占位符标签文本的

本文介绍了用于占位符标签文本的 Angular8 i18n的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 ngx-mat-select-search palceholderLabel 中添加 i18n

 

<mat-form-field class="example-full-width w-100"><mat-select (selectionChange)='vehicle_maker_updated($event)' formControlName="vehicleMakerValue" placeholder="Motor Make" i18n-placeholder><mat-option><ngx-mat-select-search formControlName="vehicleMakerFilterInputValue" placeholder="Select Motor Maker" [noEntriesFoundLabel]="'没有找到匹配的车辆制造商'" (ngModelChange)='filter_vehicle_makers($event)' i18n-placeholder><<;/ngx-mat-select-search></mat-option><mat-option *ngFor="let vehicle_maker_option of filters_vehicle_maker_options" [value]="vehicle_maker_option.id">{{vehicle_maker_option.name}}</mat-option></mat-select><mat-error *ngIf="vehicleMakerValue.hasError('required')" i18n>选择电机品牌</mat-error></mat-form-field>

我已经添加了 i18n 占位符但它不起作用

解决方案

您需要使用 placeholderLabel 属性(请参阅 https://github.com/bithost-gmbh/ngx-mat-select-search#inputs)

<ngx-mat-select-searchformControlName="vehicleMakerFilterInputValue"placeholderLabel="选择电机制造商"[noEntriesFoundLabel]="'找不到匹配的汽车制造商'"(ngModelChange)='filter_vehicle_makers($event)'i18n-placeholderLabel></ngx-mat-select-search>

其中 placeholderLabeli18n-placeholderLabel 属性是相关的

How to add i18n in ngx-mat-select-search palceholderLabel

       <div class="form-group col-md-6 mb-lg-5 mb-4">
              <mat-form-field class="example-full-width w-100">
                <mat-select (selectionChange)='vehicle_maker_updated($event)' formControlName="vehicleMakerValue" placeholder="Motor Make" i18n-placeholder>
                  <mat-option>
                    <ngx-mat-select-search formControlName="vehicleMakerFilterInputValue" placeholder="Select Motor Maker" [noEntriesFoundLabel]="'No matching vehicle makers found'" (ngModelChange)='filter_vehicle_makers($event)' i18n-placeholder></ngx-mat-select-search>
                  </mat-option>
                  <mat-option *ngFor="let vehicle_maker_option of filtered_vehicle_maker_options" [value]="vehicle_maker_option.id">
                    {{vehicle_maker_option.name}}
                  </mat-option>
                </mat-select>
                <mat-error *ngIf="vehicleMakerValue.hasError('required')" i18n>
                  Select motor make
                </mat-error>
              </mat-form-field>
          </div>

i have already added the i18n-placeholder but its not working

解决方案

you need to use the placeholderLabel attribute (see https://github.com/bithost-gmbh/ngx-mat-select-search#inputs)

<ngx-mat-select-search
formControlName="vehicleMakerFilterInputValue"
placeholderLabel="Select Motor Maker"
[noEntriesFoundLabel]="'No matching vehicle makers found'"
(ngModelChange)='filter_vehicle_makers($event)'
i18n-placeholderLabel>
</ngx-mat-select-search>

where the placeholderLabel and i18n-placeholderLabel attributes are relevant

这篇关于用于占位符标签文本的 Angular8 i18n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 02:53