1

I am facing issue while using ng2-charts. Error image

here is my systemjs config code

<script>
        System.config({
            packages: {
                app: {
                    format: 'register',
                    defaultExtension: 'js'
                }
            }
        });
        System.import('app/boot')
              .then(null, console.error.bind(console));
</script>

angular2-polyfills.js:138 Uncaught SyntaxError: Unexpected token < Evaluating localhost:48512/ng2-charts/ng2-charts Error loading localhost:48512/app/boot.jsrun @ angular2-polyfills.js:138 Failed to parse SourceMap: localhost:48512/js/system.js.map

enter image description here

3
  • What error? . . .. Commented May 5, 2016 at 11:08
  • click on Error image I attached the image Günter Zöchbauer Commented May 5, 2016 at 11:12
  • 1
    It would be better to add images inline instead of linking to external resources. In addition adding the error message as text would also be a good idea for other devs that run into the same issue to be able to search for it. Commented May 5, 2016 at 11:19

1 Answer 1

0

I ran into a similar issue and was able to resolve it by adding the following to my systemjs.config file

packages: {
        app: {
            defaultExtension: 'js',
            meta: {
                './*.js': {
                    loader: 'src/systemjs-angular-loader.js'
                }
            }
        },
        rxjs: { defaultExtension: 'js' },
        'ng2-charts': {
            main: 'ng2-charts.js',
            defaultExtension: 'js'
        }
    }
});

I encountered some other hurdles configuring the library which I documented here http://spartansoft.net/installing-ng2-charts-for-an-angular-4-project/. Hopefully it can help others.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.