首页 > 解决方案 > 角显示错误:ERROR TypeError: Cannot read property 'pipe' of undefined

问题描述

在模板中,我使用 mat-select 但在控制台中,显示以下问题。“错误类型错误:无法读取未定义的属性‘管道’”

我在这里没有使用任何管道,但为什么会出现?如果我注释掉(mat-select)部分,则不会出现错误。解决方案是什么?

            // component.html file

            <div class="grid-dropdown">
            <mat-label>Choose Organization</mat-label>
            <mat-select [(ngModel)]="selectedOrgId" placeholder="Select Org" name="batch" (selectionChange)="orgChange(selectedOrgId)">
                <mat-option *ngFor="let option of loadedOrganization" [value]="option.org_id">{{ option.org_name }}</mat-option>
            </mat-select>
           </div>

          // component.ts file
          
           orgChange(e: any) {
              console.log('selection works=>', e);
           }

如果我选择任何选项,将触发 orgChange() 方法,并且应在 ts 文件中调用相应的方法。但这不会发生。我认为上述错误可能会导致此问题。

标签: javascripthtmlangulardata-bindingangular-material

解决方案


推荐阅读