Search code examples
angular5angular-clingx-bootstrap

ng add is not working for ngx-bootstrap using angular 5


I m trying to integrate ngx-bootstrap with angular5 and trying to add its components.

ng add ngx-bootstrap  --component alerts

It's throwing error:

The specified command add is invalid. For available options, see ng help.


Solution

  • You can use another method wich is installing it manually,

    Install ngx-bootstrap from npm, run this command in your project root folder

    npm install ngx-bootstrap --save
    

    Add needed package to NgModule imports:

    import { AlertModule } from 'ngx-bootstrap';
    
    @NgModule({
      imports: [AlertModule.forRoot(),...]
    })
    

    For Bootstrap3,

    <!-- index.html -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    

    For Bootstrap4,

    <!--- index.html -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
    

    [Source]

    UPDATE:

    [Here is] complete implementation of Angular5 + ngx-bootstrap from scratch