Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MdBootstrap with Angular

How to make bootstrap material design with Angular.

Here is what i have tried so far . I am using cli to build my angular project.

angular-cli.json file

I have installed MDB using npm and added these to my angular cli json file.

"styles": [
        "styles.css",
        "../node_modules/mdbootstrap/css/bootstrap.css",
        "../node_modules/mdbootstrap/css/mdb.css"
      ],
      "scripts": [
        "../node_modules/mdbootstrap/js/jquery-3.1.1.js",
        "../node_modules/mdbootstrap/js/tether.js",
        "../node_modules/mdbootstrap/js/bootstrap.js",
        "../node_modules/mdbootstrap/js/mdb.js"
      ],

Now i add the code to the component.

<button type="button" class="btn btn-warning">Warning</button>

The code throws no error but the click wave and click are not functioning. Please help

like image 559
INFOSYS Avatar asked Jul 09 '17 15:07

INFOSYS


People also ask

Can I use bootstrap and angular material together?

Can I use Angular Material and Bootstrap together? Yes, you can use parts of Angular Material and Bootstrap together in the same web or mobile project. Developers need to be careful not to use the same components, which can clash.

What is Mdbootstrap used for?

It is used to design a fully responsive and mobile-friendly layout using various components, plugins, animations to make it more attractive and user friendly which are compatible with other browsers.

How do I add bootstrap to angular app?

Adding bootstrap using the angular.Open the file and perform the following commands, node_modules/bootstrap/dist/css/bootstrap. css in the projects->architect->build->styles array, node_modules/bootstrap/dist/js/bootstrap. js in the projects->architect->build->scripts array, node_modules/bootstrap/dist/js/bootstrap.

Is MDB angular free?

Free for personal and commercial use Our license is user-friendly. Feel free to use MDB for both private as well as commercial projects.


2 Answers

To use mdbootstrap in Angular you should install the Angular version via npm:

npm i angular-bootstrap-md -save

FontAwesome is used as well, so be sure to add it to your styles:

"../node_modules/font-awesome/scss/font-awesome.scss"

And finally, in your app.module.ts you need to include:

import { MDBBootstrapModule } from 'angular-bootstrap-md';
import { NO_ERRORS_SCHEMA } from '@angular/core';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
   ...,
    MDBBootstrapModule.forRoot()
  ],
  schemas: [NO_ERRORS_SCHEMA]
})

See more on their github page:

https://github.com/mdbootstrap/Angular-Bootstrap-with-Material-Design

like image 68
Z. Bagley Avatar answered Sep 28 '22 12:09

Z. Bagley


Assuming you installed the npm package, and configured it correctly (see here), you just need to add the mdbRippleRadius directive in button tag, like this:

<button type="button" class="btn btn-warning" mdbRippleRadius>Warning</button>

Hope it helps!

like image 43
menestrello Avatar answered Sep 28 '22 11:09

menestrello