Angular Material 对象(...) 不是一个函数
Angular Material Object(...) is not a function
我正在尝试使用 angular material 日期选择器,但我在安装时遇到了问题
我不断收到此错误:
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 和 material 软件包有关,但我已确保这些在 6.1.0 内联使用 angular 版本 6
"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 文件中收到超过 79 条关于 "export 'ɵɵinject' was not found in '@angular/core'
的警告。
不确定这是相关的还是单独的问题?
您可能忘记了添加命令。
应该可行:
npm install --save @angular/material @angular/cdk @angular/animations
然后:
ng add @angular/material
我正在尝试使用 angular material 日期选择器,但我在安装时遇到了问题
我不断收到此错误:
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 和 material 软件包有关,但我已确保这些在 6.1.0 内联使用 angular 版本 6
"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 文件中收到超过 79 条关于 "export 'ɵɵinject' was not found in '@angular/core'
的警告。
不确定这是相关的还是单独的问题?
您可能忘记了添加命令。
应该可行:
npm install --save @angular/material @angular/cdk @angular/animations
然后:
ng add @angular/material