Search code examples
typescriptnpmangularaccordionng2-bootstrap

accordion (ng2-accordion) in angular2


Am using accordion with angular-2,but its not working properly,its throwing an error 404, its a third-party plugin named "ng2-accordion".

Path of the package that am giving is correct.

Actual bug in the inspect is given below.

  1. GET http://localhost:3000/ng2-accordion/ng2-accordion 404 (Not Found)
  2. Error: Error: XHR error (404 Not Found) loading http://localhost:3000/ng2-accordion/ng2-accordion(…)

enter image description here


Solution

  • You need to add mapping to your system.js configuration like this:

    {
        "map": {
            "ng2-accordion": "node_modules/ng2-accordion"
        },
        "packages": {
            "ng2-accordion": { "main": "index.js", "defaultExtension": "js" }
        }
    }