Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 在angular 2.0.0-beta-17中使用时,客户端不显示ng2图表_Typescript_Angular_Ng2 Charts - Fatal编程技术网

Typescript 在angular 2.0.0-beta-17中使用时,客户端不显示ng2图表

Typescript 在angular 2.0.0-beta-17中使用时,客户端不显示ng2图表,typescript,angular,ng2-charts,Typescript,Angular,Ng2 Charts,我试图在angular 2应用程序中使用ng2图表,但面临问题 app.ts 从'angular2/core'导入{Component}; 从“ng2图表/ng2图表”导入{CHART_指令}; @组成部分({ 选择器:“我的应用程序”, 模板: ` ` }) 导出类AppComponent{ 构造函数(){ console.log('bar demo'); } 专用条形图选项={ ScaleShowVerticalline:错误, 回答:是的, 多工具模板:':' }; 私人条形图标签=['2

我试图在angular 2应用程序中使用
ng2图表
,但面临问题

app.ts
从'angular2/core'导入{Component};

从“ng2图表/ng2图表”导入{CHART_指令}; @组成部分({ 选择器:“我的应用程序”, 模板: ` ` }) 导出类AppComponent{ 构造函数(){ console.log('bar demo'); } 专用条形图选项={ ScaleShowVerticalline:错误, 回答:是的, 多工具模板:':' }; 私人条形图标签=['2006'、'2007'、'2008'、'2009'、'2010'、'2011'、'2012']; 私人条形图系列=['A系列','B系列']; 公共条形图类型='Bar'; 私有条形图图例:布尔值=真; 专用条形图数据=[ [65, 59, 80, 81, 56, 55, 40], [28, 48, 40, 19, 86, 27, 90] ]; //事件 (e:任何){ 控制台日志(e); } 图表悬停(e:任何){ 控制台日志(e); } }
不发布任何显示

您需要在
SystemJS
配置属性中添加一个映射,否则SystemJS不知道从何处加载它:

System.config({
  map: {
     'ng2-charts': 'node_modules/ng2-charts'
  },
  //...
});

您需要在
SystemJS
配置属性中添加映射,否则SystemJS不知道从何处加载它:

System.config({
  map: {
     'ng2-charts': 'node_modules/ng2-charts'
  },
  //...
});

@Component({…})中缺少“指令:[CHART_指令]”?我添加了指令:[CHART_指令],但出现了新的错误。。。错误。。。加载资源失败:服务器响应状态为404(未找到)angular2 polyfills.js:349错误:错误:XHR错误(未找到404)加载(…)从“ng2图表/ng2图表”导入{CHART_指令};问题updatedmissing@Component({…})中的“指令:[CHART_指令]”?我添加了指令:[CHART_指令],但出现了新的错误。。。错误。。。加载资源失败:服务器响应状态为404(未找到)angular2 polyfills.js:349错误:错误:XHR错误(未找到404)加载(…)从“ng2图表/ng2图表”导入{CHART_指令};问题更新添加map属性后,我遇到了以下错误。。。加载资源失败:服务器以404(未找到)angular2 polyfills的状态响应。js:349错误:错误:XHR错误(404未找到)加载(…)ZoneDelegate.invoke@angular2 polyfills.js:349加载资源失败:服务器以404(未找到)的状态响应您好,我使用webpack而不是systemjs how configure?@ELmissaouihabib添加到您的webpack配置中
resolve.alias
this:
'ng2-charts':'node\u modules/ng2 charts'
添加映射属性后,我遇到了这些错误。。。加载资源失败:服务器以404(未找到)angular2 polyfills的状态响应。js:349错误:错误:XHR错误(404未找到)加载(…)ZoneDelegate.invoke@angular2 polyfills.js:349加载资源失败:服务器以404(未找到)的状态响应您好,我使用webpack而不是systemjs how configure?@ELmissaouihabib添加到您的webpack配置中
resolve.alias
this:
'ng2-charts':'node_modules/ng2 charts'