Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49247

Undefined Properties in nested Component

$
0
0

@riddlerdev wrote:

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 {}

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>