fredguile / ng2-md-datatable

Angular 5+ DataTable component for using with Material Design 2
https://www.npmjs.com/package/ng2-md-datatable
MIT License
38 stars 13 forks source link

include css #49

Closed VesperDev closed 7 years ago

VesperDev commented 7 years ago

Hello how is it, it seems that I am the only one to have this problem, my question is simple as I can load the css of the table, I do not find the way to load the css, what are the steps to follow I saw the documentation but it confuses me because I am new at angular 2. Greetings and thank you very much for your time captura

fredguile commented 7 years ago

Supposing you're using Angular-CLI to bootstrap your app, I suggest enabling SCSS in .angular-cli.json:

  "defaults": {
    "styleExt": "scss",
    "component": {}
  }

Then lookup your main SCSS file and add:

@import '~@angular/material/theming';
@import '~ng2-md-datatable/datatable-theme';
...
@include mat-core();

// define your own colors here ;)
$primary: mat-palette($mat-brown, 600, 400, 800);
$accent:  mat-palette($mat-amber, 500, 300, 700);
$warn:    mat-palette($mat-red, 500, 300, 900);
$theme: mat-light-theme($primary, $accent, $warn);

@include angular-material-theme($theme);
@include mat-datatable-theme($theme);
...

You'll get more details about this here https://github.com/angular/material2/blob/master/guides/theming.md

There seem to be prebuilt themes, but I've never tried them. And it's probably more flexible to build your own using SCSS imports of the components you're using in your app.

fredguile commented 7 years ago

Feel free to comment / reopen if you need more explanation