Hello,
I’d like to have a logout button inside my navbar on all pages, but I don’t want to redeclare this button all the time. Therefore, I created a component that looks like this:
@Component({
selector: 'top',
template: `
<ion-header>
<ion-navbar>
<ng-content></ng-content>
<ion-buttons end>
<button (click)="presentPopover($event)">
<ion-icon name="more"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>`
})
export class TopComponent {
}
which I then can use using:
<top>
<ion-title>{{ person.name }}</ion-title>
<ion-buttons end>
<button>
<ion-icon name="contact"></ion-icon>
</button>
<button>
<ion-icon name="trash"></ion-icon>
</button>
</ion-buttons>
</top>
However, it does not work as expected, as you can see in the screenshot:
The reason for this is that apparantly wraps the content in an extra element (div.toolbar-content) and that the buttons inside ng-content get different class names (“button button-default button-icon-only” instead of “bar-button bar-button-default bar-button-icon-only”).
How can I add a default button on every page?