0

I'm attempting to show data in a table using Angular 7's mat-table element. I followed the relevant instructions to install material into my project: https://material.angular.io/guide/getting-started

In step 3 of link above I tried both ways of importing, both in a separate module and in app.module.ts directly.

This is from app.module.ts:

@NgModule({
  declarations: [
    AppComponent,
    NavMenuComponent,
    HomeComponent,
    CounterComponent,
    FetchDataComponent,
    AuthCallbackComponent
  ],
  imports: [
    BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
    MaterialModule,
    HttpClientModule,
    FormsModule,
    RouterModule.forRoot([
      { path: '', component: HomeComponent, pathMatch: 'full' },
      { path: 'counter', component: CounterComponent },
      { path: 'fetch-data', component: FetchDataComponent },
      { path: 'auth-callback', component: AuthCallbackComponent }
    ])
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Here is material.module.ts:

import { NgModule } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
@NgModule({
  imports: [
    MatTableModule
  ],
  exports: [
    MatTableModule
  ]
})
export class MaterialModule {}

Before the MatTableModule is imported in app.module.ts (and after the install command using angular cli) the app, in general, at least loads. After importing the app seems to fail to load, either getting stuck on "Cannot GET /" or "Loading..."

2
  • Any errors in the console log? Did you do step 4 of the guide yet?
    – favdev
    May 22, 2019 at 1:23
  • Check your command prompt and console for errors ! May 22, 2019 at 2:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.