Jhipster/md-button不是一个已知元素 [英] Jhipster / md-button is not a known element

查看:108
本文介绍了Jhipster/md-button不是一个已知元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用JHipster 4.0.1

Hello I am using JHipster 4.0.1

我想将角度2的材料集成到home.component中.

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

我做到了: npm安装材料 npm install angular2/{core,button}

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

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

错误是:md-button不是一个已知元素

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

推荐答案

对于使用yarn而不是npm的用户:

For those using yarn rather than npm:

yarn add --exact @angular/material
yarn start

将角材模块导入src/main/webapp/app/shared/shared-libs.module.ts:

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

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

将主题添加到src/main/webapp/content/css/vendor.css:

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

src/main/webapp/app/home.component.html添加一些MD元素:

    <md-card>
        <button md-button class="mat-primary">Hello </button>
    </md-card>

这篇关于Jhipster/md-button不是一个已知元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆