Undefined Properties in nested Component


#1

I am trying to use the MaterialModule in a component of one of my pages as well. Do I need to export it in my Page @NGModule or ? Right now the component cannot seem to access the module and giving me errors about undefined properties.

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';

import { MyApp } from './app.component';

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

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

@NgModule({
  bootstrap: [IonicApp],
  declarations: [
    MyApp
  ],
  entryComponents: [
    MyApp
  ],
  imports: [
    BrowserModule,
    MaterialModule,
    IonicModule.forRoot(MyApp),
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

randompage.module.ts

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { RandomPage } from './random';
import { MapboxComponent } from '../../components/mapbox/controller';
import { MapboxViewComponent } from '../../components/mapbox/view';
import { RandomMapViewComponent } from '../../components/random-map/random-map-view';
import { RandomMapComponent } from '../../components/random-map/random-map';

@NgModule({
  declarations: [
    RandomPage,
    MapboxComponent,
    MapboxViewComponent,
    RandomMapComponent,
    RandomMapViewComponent
  ],
  imports: [
    IonicPageModule.forChild(RandomPage)
  ],
  exports: [
    RandomPage
  ]
})

export class RandomPageModule {}

#2

MaterialModule is deprecated and slated to be removed.


#3

Do you have a link stating that? Is that what is causing the issue or for stuff like this do I need to do more in my exports and such?


#4

This is the first hit in a Google search I just ran on the phrase “MaterialModule deprecated.” See breaking changes in cesium-cephalopod, from April.


#5

Thanks, did not scroll down the page, was just looking at the last release.