I am trying to import a node module in Angular 2, but to no avail.
How can this be achieved?
I am trying to import the following module in Angular 2:
https://www.npmjs.com/package/countryjs
Do I need to use system.js to register in the current application:
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
map: {
'countryjs': 'node_modules/countryjs/lib/countryjs'
},
meta: {
'vendor/*': {
'format': 'global'
}
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
Then in the ts file I use:
import {} from "countryjs"
When I use this (below) it gives me an error
import {Country} from "countryjs"
Did I miss something?
source
share