角度材料样式未加载

时间:2017-10-24 10:51:42

标签: angular angular-material2

我有一个新的Angular-Cli项目,角度/材质

public class PendingFollowupVO extends BaseObservable
{
    private  String CustomerName;
    private  long CustomerId;
    private  String InvoiceNo;
    private String DueDate;

    private  String PromisedDate;
    private  double InvAmount;
    private  double BalAmount;

    public PendingFollowupVO() {
        super();
    }

    public long getCustomerId() {
        return CustomerId;
    }

    public void setCustomerId(long customerId) {
        CustomerId = customerId;
    }

    public double getInvAmount() {
        return InvAmount;
    }

    public void setInvAmount(double invAmount) {
        InvAmount = invAmount;
    }

    public String getCustomerName() {
        return CustomerName;
    }

    public void setCustomerName(String customerName) {
        CustomerName = customerName;
    }

    public String getInvoiceNo() {
        return InvoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        InvoiceNo = invoiceNo;
    }

    public String getDueDate() {
        return DueDate;
    }

    public void setDueDate(String dueDate) {
        DueDate = dueDate;
    }

    public String getPromisedDate() {
        return PromisedDate;
    }

    public void setPromisedDate(String promisedDate) {
        PromisedDate = promisedDate;
    }

    public double getBalAmount() {
        return BalAmount;
    }

    public void setBalAmount(double balAmount) {
        BalAmount = balAmount;
    }
}

我在app.module中包含了所需的模块。 为scss文件添加了node-sass。 还在theme.scss

中添加了主题
"dependencies": {
  "@angular/animations": "^4.4.6",
  "@angular/cdk": "^2.0.0-beta.12",
  "@angular/common": "^4.4.6",
  "@angular/compiler": "^4.4.6",
  "@angular/core": "^4.4.6",
  "@angular/forms": "^4.4.6",
  "@angular/http": "^4.4.6",
  "@angular/material": "^2.0.0-beta.12",
  "@angular/platform-browser": "^4.4.6",
  "@angular/platform-browser-dynamic": "^4.4.6",
  "@angular/router": "^4.4.6",

将该文件导入app.module.ts

@import '~@angular/material/theming';

@include mat-core();
$primary: mat-palette($mat-orange, 800);
$accent: mat-palette($mat-light-blue, 600, A100, A400);
$warn: mat-palette($mat-red, 600);
$theme: mat-light-theme($primary, $accent, $warn);

@include angular-material-theme($theme);

并添加到angular-cli.json

import './../theme.scss';

它在控制台中编译并且没有错误。 但是没有加载样式。我也试过预建主题 还尝试直接从index.html加载预构建主题。

可能缺少什么?

1 个答案:

答案 0 :(得分:0)

我忘了用<md-替换一些<mat-元素 遗憾的是,即使元素不再存在,控制台中也没有错误(缺少组件)。或者至少没有可用的样式。