angular2-pagination-example
angular2-pagination-example copied to clipboard
Unable us use underscore.js library in this project
1.I have installed underscore as
npm install underscore
2.Then I have included it in my systemjs.config.js
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/',
'underscore': 'node_modules/underscore/underscore.js'
},
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'underscore': {
main: 'underscore.js',
defaultExtension: 'js'
}
}
- Now to use it in the pager.service.ts
import * as _ from 'underscore';
But it says : cannot find module underscore
My directory structure goes like:
>app
>services
--index.ts
--pager.service.ts
>templates
--app.component.html
app.component.ts
app.module.ts
main.ts
>node modules
>underscore
--underscore.js
>typings
index.html
typings.json
package.json
systemjs.config.js
tsconfig.json
Any guidance would be appreciated:)
Following the files config and running npm install && npm start
it worked.