2
我的Angular 2項目是使用angular-cli 1.0.0-beta.30版本創建的。我正在使用ngx-charts版本4.1.2庫。條形圖組件工作正常,但是當我添加折線圖時,運行應用程序時會引發TypeError異常。在Chrome版本運行時,誤差是「包含」在[行chart.component.ts] [1]的源文件240線功能38.折線圖顯示正確的FirefoxAngular 2 - TypeError undefined不是Array的函數
if (!values.includes(d.name)) {
values.push(d.name);
}
我如何使數組包含我的應用程序已知的函數?
在我tsconfig.json文件我有
"lib": ["es6", "dom"],
我的package.json文件包含以下
{
"name": "dashboards",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "^2.4.5",
"@angular/compiler": "^2.4.5",
"@angular/core": "^2.4.5",
"@angular/forms": "^2.4.5",
"@angular/http": "^2.4.5",
"@angular/platform-browser": "^2.4.5",
"@angular/platform-browser-dynamic": "^2.4.5",
"@angular/router": "^3.4.1",
"@swimlane/ngx-charts": "^4.1.2",
"core-js": "^2.4.1",
"d3": "^4.4.0",
"rxjs": "^5.0.3",
"ts-helpers": "^1.1.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.30",
"@angular/compiler-cli": "^2.4.5",
"@types/d3": "^4.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.4.0",
"protractor": "~4.0.14",
"ts-node": "1.7.2",
"tslint": "^4.3.0",
"typescript": "~2.0.10"
}
}
我polyfills.ts文件包含
import 'core-js/es6/array';
我已經通過ngx圖表演示和其他例子看,但我不明白爲什麼我收到錯誤。
謝謝