Am trying to make a custom component that handles a navbar that I will be using in many pages that are accessible through a menu., this component has three ion icons inside buttons, however when I put the HTML code in a component.html and use that component selector in the page HTML, the icons are not displayed even though they’re there because I can press them. However if I put the code directly in the page HTML, it works correctly.
Here’s my shared components module
import { TestNavbarComponent } from './test-navbar/test-navbar';
import { NgModule } from '@angular/core';
import { IonicModule } from 'ionic-angular';
import { BalanceComponent } from './balance/balance';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
@NgModule({
declarations: [BalanceComponent, TestNavbarComponent],
imports: [TranslateModule.forChild(),
IonicModule.forRoot(TestNavbarComponent)],
exports: [BalanceComponent, TestNavbarComponent]
})
export class ComponentsModule { }
Here’s my component HTML
<button ion-button icon-only menuToggle>
<ion-icon [name]="menuIcon"></ion-icon>
</button>
<ion-title>
<ion-buttons>
<button ion-button icon-only class="pink">
<ion-icon [name]="menuIcon ? 'menu' : 'close'"></ion-icon>
</button>
</ion-buttons>
</ion-title>
<ion-buttons right>
<button ion-button icon-only>
<ion-icon name="menu"></ion-icon>
</button>
</ion-buttons>
And here’s what happens if I use component vs page HTML
I think the problem is from the IonicModule.forRoot(TestNavbarComponent) but I can’t use ionic components if I don’t.