Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jhipster / md-button is not a known element

Hello I am using JHipster 4.0.1

I want integrate angular 2 material into my home.component.

I did : npm install material npm install angular2/{core,button}

 <html><head></head>
<body> 
<md-button>Hello </md-button></body></html>

the error is : md-button is not a known element

like image 430
Chebbi Ala Eddine Avatar asked Jan 04 '23 13:01

Chebbi Ala Eddine


1 Answers

For those using yarn rather than npm:

yarn add --exact @angular/material
yarn start

Import angular material module into src/main/webapp/app/shared/shared-libs.module.ts:

import { MaterialModule } from '@angular/material';

@NgModule({
    imports: [
        MaterialModule,
        ...        ],
    exports: [
        MaterialModule,
        ...

Add a theme into src/main/webapp/content/css/vendor.css:

@import '~@angular/material/core/theming/prebuilt/deeppurple-amber.css';

Add some MD elements to src/main/webapp/app/home.component.html:

    <md-card>
        <button md-button class="mat-primary">Hello </button>
    </md-card>
like image 146
Gaël Marziou Avatar answered Jan 13 '23 19:01

Gaël Marziou