I am trying to import a node module into Angular 2 but with no avail.
How can this be achieved?
I am trying to import the following module into Angular 2: https://www.npmjs.com/package/countryjs
Do i need to use system.js to register it into the current app:
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
map: {
'countryjs': 'node_modules/countryjs/lib/countryjs'
},
meta: {
// sets meta for modules within the package
'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"
Am I missing something?