Обновление с angular 8 до Angular 9 - ошибки - PullRequest
2 голосов
/ 27 января 2020

Я следую официальной документации по обновлению angular приложения, и после того, как я обновляю все, при запуске ng serve я получаю следующие ошибки

ERROR in app/src/app/users/add/add.component.html:14:48 - error NG2345: Argument of type 'AbstractControl' is not assignable to parameter of type 'FormControl'.
  Type 'AbstractControl' is missing the following properties from type 'FormControl': registerOnChange, registerOnDisabledChange, _applyFormState

  <ng-container *ngFor="let error of errors(addNewUserForm.get('username'))">



   Error occurs in the template of component UserProfileComponent.
app/src/app/registration/dialog/dialog.component.html:1:1 - error NG8001: 'mat-horizontal-stepper' is not a known element:
1. If 'mat-horizontal-stepper' is an Angular component, then verify that it is part of this module.
2. If 'mat-horizontal-stepper' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

  <mat-horizontal-stepper linear #stepperRegistration>

те же ошибки для mat-dialog-actions, mat-step, mat-dialog-content et c

и ...

Error occurs in the template of component DialogComponent.
app/src/app/registration/dialog/dialog.component.html:46:13 - error NG8002: Can't bind to 'errorStateMatcher' since it isn't a known property of 'input'.

[errorStateMatcher]="matcher"

вот мой пакет. json

"dependencies": {
    "@angular/animations": "^9.0.0-rc.10",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "^9.0.0-rc.10",
    "@angular/compiler": "^9.0.0-rc.10",
    "@angular/core": "^9.0.0-rc.10",
    "@angular/flex-layout": "^8.0.0-beta.27",
    "@angular/forms": "^9.0.0-rc.10",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "^9.0.0-rc.10",
    "@angular/platform-browser-dynamic": "^9.0.0-rc.10",
    "@angular/router": "^9.0.0-rc.10",
    "@angular/service-worker": "^9.0.0-rc.10",
    "@ngrx/effects": "^8.6.0",
    "@ngrx/schematics": "^8.6.0",
    "@ngrx/store": "^8.6.0",
    "@ngrx/store-devtools": "^8.6.0",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.4.1",
    "keycloak-angular": "^7.1.0",
    "keycloak-js": "^6.0.1",
    "popper.js": "^1.16.0",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.0-rc.10",
    "@angular-devkit/schematics": "^8.3.23",
    "@angular/cli": "^9.0.0-rc.10",
    "@angular/compiler-cli": "^9.0.0-rc.10",
    "@angular/language-service": "^9.0.0-rc.10",
    "@compodoc/compodoc": "^1.1.11",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.1",
    "protractor": "~5.4.0",
    "rxjs-tslint-rules": "^4.28.0",
    "ts-node": "~7.0.0",
    "tslint": "^5.20.1",
    "tslint-angular": "^3.0.2",
    "tslint-sonarts": "^1.9.0",
    "typescript": "~3.7.5",
    "webpack-bundle-analyzer": "^3.6.0"
  }

1 Ответ

0 голосов
/ 27 января 2020

Проверьте ваш модуль на наличие диалогового окна компонента. Вы должны импортировать MatStepperModule. Аналогичным образом обновите модули, в которых вы использовали другие из библиотеки материалов, например:

import {MatStepperModule} from '@angular/material/stepper';
import {MatDialogModule} from '@angular/material/dialog';

Так что ошибка в решении [errorStateMatcher]="matcher" выше должна исправить это, поскольку он не может найти компонент компонента, и он @Input().

...