简体   繁体   English

材料 8 库不适用于 AOT 模式

[英]Material 8 libraries not working with AOT mode

I am using MatSelect, MatChips and many other Mat libraries but none seem to work with AOT mode enabled.我正在使用 MatSelect、MatChips 和许多其他 Mat 库,但似乎都没有启用 AOT 模式。 Dropdowns, MatChip inputs are not responding after clicks.下拉菜单,MatChip 输入在点击后没有响应。 They are working without AOT.他们在没有 AOT 的情况下工作。 Below is my package.json file and code snippet for MatSelect.下面是我的 package.json 文件和 MatSelect 的代码片段。 I have imported MatSelectModule and all other required Material modules.我已经导入了 MatSelectModule 和所有其他必需的 Material 模块。 Not able to get what am I missing here.无法得到我在这里想念的东西。 Please help.请帮忙。

PS I tried removing [(ngModel)] and setting it in the ts file but it still doesn't work. PS 我尝试删除 [(ngModel)] 并将其设置在 ts 文件中,但它仍然无法正常工作。

package.json package.json

"dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "^8.2.2",
    "@angular/common": "^8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/forms": "^8.2.14",
    "@angular/material": "8.2.2",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "^8.2.14",
    "@azure/msal-angular": "^1.0.0",
    "@ng-idle/core": "^9.0.0-beta.1",
    "@ng-select/ng-select": "^0.23.0",
    "@types/c3": "^0.6.2",
    "angular2-text-mask": "^9.0.0",
    "angular2-uuid": "^1.1.1",
    "c3": "^0.6.8",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "exceljs": "4.0.0",
    "file-saver": "^2.0.2",
    "jspdf": "^1.5.3",
    "jspdf-autotable": "^2.3.5",
    "msal": "^1.3.2",
    "ng-pick-datetime": "^5.2.6",
    "ng2-currency-mask": "^5.3.1",
    "ngx-bootstrap": "^5.6.1",
    "ngx-chips": "^1.9.2",
    "ngx-infinite-scroll": "^0.8.4",
    "ngx-masonry": "^1.1.2",
    "ngx-mat-select-search": "^1.8.0",
    "ngx-print": "^1.1.4",
    "ngx-toastr": "^10.0.4",
    "rxjs": "^6.4.0",
    "rxjs-compat": "^6.6.0",
    "tslib": "^1.10.0",
    "xlsx": "^0.14.3",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.28",
    "@angular/cli": "^8.3.28",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "^8.2.14",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~14.0.14",
    "codelyzer": "^5.0.1",
    "gzipper": "^4.0.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "3.4.5"
  }
<div class="formItem">
    <mat-form-field [ngClass]="isResetClicked ? 'mat-form-field-reset' : ''">
        <mat-select [(ngModel)]="objAddTodo.timezoneId" placeholder="Time Zone *" formControlName="timeZone" id="timeZone"
                    disableOptionCentering panelClass="disableOptionCentering">
            <mat-option *ngFor="let timeZone of timeZoneList" [value]="timeZone.timezoneId">
                {{ timeZone.timezoneName }}
            </mat-option>
        </mat-select>
        <mat-error *ngIf="(addTodoForm.get('timeZone').hasError('required') && isSubmitClicked)">
            Time
            Zone
            is required
        </mat-error>
    </mat-form-field>
</div>

I was finally able to solve this.我终于能够解决这个问题。 "ng-pick-datetime" was the culprit (actually I missed updating it ) and the older version was causing all Material libraries to misbehave in AOT mode. “ng-pick-datetime”是罪魁祸首(实际上我错过了更新它),旧版本导致所有材料库在 AOT 模式下行为不端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM