I've been trying to figure out how to re-use items in different pages without copy and pasting them. I thought I'd start with something easy and make the header menu a separate file that I ng-include. Little did I know... here's the header.html file:
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>List</ion-title>
</ion-navbar>
</ion-header>
The framework was made with ionic start sample-app sidemenu
. The header.html file is in /pages/common/ folder. To include this I've tried all of these.
<ion-header ng-include="'header.html'">
</ion-header>
<ion-header ng-include="'../common/header.html'">
</ion-header>
<ion-header ng-include="'pages/common/header.html'">
</ion-header>
<ion-header ng-include src="'pages/common/header.html'">
</ion-header>
<ion-header>
<div ng-include src="'pages/common/header.html'"></div>
</ion-header>
<ion-header>
<div ng-include="" src="'pages/common/header.html'"></div>
</ion-header>
and possibly a dozen other variations that I've found in different docs, blogs, SO posts, etc (I tried them separately of course). I tried it with the tag in the header file, and without. I tried wrapping the content in tags as well. Nothing seems to work. Can anybody tell me what works for them in this scenario?
Perhaps I'm going in the wrong direction and I should be looking at making a custom menu component?
TIA, Mike