Error trying to load a mat-table with angle 6

0

Starting with Angular 6. When trying to create a table, based on an example I got, I started to have the following problem. I've added these lines to my main module :

import { MatInputModule, MatPaginatorModule, MatProgressSpinnerModule, 
         MatSortModule, MatTableModule } from '@angular/material';

In the imports section I also added, as below:

imports: [
    BrowserModule,
    FormsModule,
    BrowserAnimationsModule,
    HttpClientModule,
    MatInputModule,
    MatTableModule,
    MatPaginatorModule,
    MatSortModule,
    MatProgressSpinnerModule
  ],

Well, it turns out that on this line I get the following error:

from '@angular/material';
  

[ts] Can not find module '@ angular / material'.

And also in the imports, it gives error in these two faces

BrowserAnimationsModule,
HttpClientModule,

So what I did. I went to the package.json application and added this line:

"@angular/material": "^6.0.3",

Well, anyway the error persists. Has anyone had this and solved it? I'm researching, but so far no conclusive answer.

    
asked by anonymous 03.07.2018 / 00:53

1 answer

1

From the angular material documentation each import has its own path. This is to try to be as modular as possible. For example:

import {MatInputModule} from '@angular/material/input';
    
03.07.2018 / 09:31