angular2-pagination-example icon indicating copy to clipboard operation
angular2-pagination-example copied to clipboard

Unable us use underscore.js library in this project

Open Apps-23 opened this issue 8 years ago • 1 comments

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'
            }
        }
  1. 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:)

Apps-23 avatar Oct 07 '16 06:10 Apps-23

Following the files config and running npm install && npm start it worked.

rochapablo avatar Jan 05 '17 12:01 rochapablo