Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 材料自动完成面板问题_Angular_Angular Material - Fatal编程技术网

Angular 材料自动完成面板问题

Angular 材料自动完成面板问题,angular,angular-material,Angular,Angular Material,在我的angular 4项目中,我遇到了材质自动完成的问题。 当我键入内容,组件显示建议时,如果我滚动页面,我会看到建议面板与自动完成字段未链接,如图中所示。 但实际上我没有这个问题 这是我的代码: <mat-form-field> <input matInput placeholder="{{'customer.detail.labels.country' | translate }}" required [matAutocomplete]

在我的angular 4项目中,我遇到了材质自动完成的问题。 当我键入内容,组件显示建议时,如果我滚动页面,我会看到建议面板与自动完成字段未链接,如图中所示。 但实际上我没有这个问题

这是我的代码:

<mat-form-field>
        <input matInput placeholder="{{'customer.detail.labels.country'
          | translate }}" required [matAutocomplete]="tdAuto" name="country" #country="ngModel" [(ngModel)]="selected.country"
          (ngModelChange)="searchCountry($event)"> </mat-form-field>
            <mat-autocomplete #tdAuto="matAutocomplete" [displayWith]="displayFn">
            <mat-option (onSelectionChange)="setCountry(country)" *ngFor="let country of countries" [value]="country">
                <div class="row">
                  <img src="assets/img/flags24/{{country.alpha2Code | lowercase}}.png" />
                    <span>{{country.name}} ({{country.alpha2Code}})</span>
                </div>
            </mat-option>
        </mat-autocomplete>

{{country.name}}({{country.alpha2Code})

在组件中使用CdkScrollable。还可以将其添加到模块文件中的导入。

应该围绕整个自动完成,而不仅仅是输入。不确定taht是否修复了它though@Shadowlauch不幸的是,没有t@Alessandro您可以指定您使用的是哪个版本的angular material吗?@The.Bear是的,对不起,我使用的是“@angular/material”:“^2.0.0-beta.12”和angular 4.4.4最新版本的angular/material中仍然存在这种情况,发生的是滚动事件从未被绑定到容器覆盖上-如果组件没有嵌套在布局中,也不会发生