角材料对象(...)不是函数

时间:2019-07-23 14:42:04

标签: angular angular-material angular-material-datetimepicker

我正在尝试使用角形材料日期选择器,但在安装时遇到问题

我不断收到此错误:

Uncaught TypeError: Object(...) is not a function
    at Object../node_modules/@angular/cdk/esm2015/bidi.js (bidi.js:92)
    at __webpack_require__ (bootstrap:76)
    at Object../node_modules/@angular/material/esm2015/core.js (chips.js:1718)
    at __webpack_require__ (bootstrap:76)
    at Object../node_modules/@angular/material/esm2015/autocomplete.js (forms.js:6371)
    at __webpack_require__ (bootstrap:76)
    at Object../node_modules/@angular/material/esm2015/material.js (list.js:1076)
    at __webpack_require__ (bootstrap:76)
    at Object../src/app/app.module.ts (app.component.ts:10)
    at __webpack_require__ (bootstrap:76)

通过搜索其他帖子,这似乎与使用不同版本的cdk和材料包有关,但我已确保使用角度版本6的版本在6.1.0内联

  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.1.0",
    "@angular/common": "^6.1.7",
    "@angular/compiler": "^6.1.7",
    "@angular/core": "^6.1.7",
    "@angular/forms": "^6.1.7",
    "@angular/http": "^6.1.7",
    "@angular/material": "^6.1.0",
    "@angular/platform-browser": "^6.1.7",
    "@angular/platform-browser-dynamic": "^6.1.7",
    "@angular/router": "^6.1.7",
    "@types/jquery-knob": "^1.2.31",
    "angular-froala-wysiwyg": "^2.8.5",
    "chart.js": "^2.7.2",
    "core-js": "^2.5.4",
    "jquery": "^3.3.1",
    "jquery-knob": "^1.2.11",
    "lodash.clonedeep": "^4.5.0",
    "ng2-charts": "^1.6.0",
    "ng2-date-picker": "^2.12.0",
    "ngx-autosize-input": "^2.2.2",
    "ngx-dropzone-wrapper": "^7.2.1",
    "ngx-perfect-scrollbar": "^7.2.1",
    "rxjs": "^6.3.2",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.7.4",
    "@angular/cli": "^6.1.4",
    "@angular/compiler-cli": "^6.1.7",
    "@angular/language-service": "^6.1.7",
    "@angularclass/hmr": "^2.1.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.9.2"
  }

我还在多个.js文件中收到"export 'ɵɵinject' was not found in '@angular/core'的79条警告。 不确定这是相关问题还是单独的问题?

1 个答案:

答案 0 :(得分:2)

您可能忘记了添加命令。

应该可以:

npm install --save @angular/material @angular/cdk @angular/animations

然后:

ng add @angular/material