angularjasny-bootstrap

How to Import jasny-bootstrap to Angular 4?


Jasny Bootstrap:

https://github.com/jasny/bootstrap

Installed: npm install jasny-bootstrap --save

Imported in app/app.module.ts or main.ts

import * as jasny from 'jasny-bootstrap';

I got this error:

ERROR in /Users/Roller/Working/Angular4/src/app/app.module.ts (11,24): Cannot find module 'jasny-bootstrap'.


Solution

  • jasny-bootstrap is not Angular module, it's just javascript library. If you use angular-cli, you can include this script in your .angular-cli.json file. That's how you do this:

    "scripts": [
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/bootstrap/dist/js/bootstrap.min.js"
    ]
    

    and the same thing with css files:

    "styles": [
        "../node_modules/bootstrap/dist/js/bootstrap.min.css"
    ]