angular-cli, Google Visualization Charts, SystemJS -
i'm building charts app angular 2 (angular-cli) , google charts.
just putting google-loader script tags in index.html works in development mode, when building production (everything bundled) error
typeerror: cannot read property 'arraytodatatable' of undefined
when calling
google.visualization.arraytodatatable(data);
the next thing tried putting loader.js in systemjs config:
const map: = { 'google-visualization': 'https://www.gstatic.com/charts/loader.js' };
importing in main.ts
import 'google-visualization';
and loading corechart package in app.ts
google.charts.load('current', { 'packages': ['corechart'], 'language': 'pl' });
now error saying
xmlhttprequest cannot load https://www.gstatic.com/charts/loader.js. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:4200' therefore not allowed access.
is there other way of loading google visualization api without proxy in between?
Comments
Post a Comment