Added component, menu disappears


#1

I used the cli to add a new component. It created a component’s module and the component. I imported said module into a page, which itself was its own module. Now that page loses the menu button. If I remove the component module from the page module, the menu button re-appears.

Page Module

import { ComponentsModule } from './../../components/components.module';
import { NgModule } from '@angular/core';
import { IonicPageModule, IonicModule } from 'ionic-angular';
import { SocialPage } from './social';

@NgModule({
  declarations: [
    SocialPage,
  ],
  imports: [
    ComponentsModule,
    IonicPageModule.forChild(SocialPage),
  ]
})
export class SocialPageModule {}

The component module:

import { NgModule, Component } from '@angular/core';

import { IonicModule } from 'ionic-angular';
import { LandingComponent } from './landing/landing';
import { Content } from 'ionic-angular';
@NgModule({
	declarations: [LandingComponent],
	imports: [IonicModule.forRoot(LandingComponent)],
	exports: [LandingComponent]
})
export class ComponentsModule {}

No other code changed.

Any ideas? I’m using the latest of everything (stable).


#2

Change this to just IonicModule.


#3

That worked. What is the difference? I thought I needed that because VS Code said that wasn’t resolved in the template.

Looking at the template, I found that I removed the ion-content, because it added a random white box to the bottom of the component. Perhaps this should be another question.


#4

Not sure I can answer that precisely, but I can say that forRoot() should only be called in the app module on the app component.