ionic-epubjs icon indicating copy to clipboard operation
ionic-epubjs copied to clipboard

Move Chapter Menu to Sidemenu

Open ibby89 opened this issue 6 years ago • 3 comments

Hi Jan,

I've been trying and trying with this but cannot get the chapter menu into the sidemenu unfortunately.

I am aware that the TOC page maps the epub chapter data using navParams, and this cannot be done on app.ts as the sidemenu data is mapped using ViewChild(Nav).

If I set the app.html up to list the chapters exactly as the TOC page does, could you let me know what I am doing wrong? It currently looks like this:

<ion-menu [content]="content">
    <ion-header>
      <ion-toolbar>
        <ion-title>Menu</ion-title>
      </ion-toolbar>
    </ion-header>
  
    <ion-content>
      <ion-list>
        <ion-item class="toc" *ngFor="let chapter of toc" (click)="selectToc(chapter)">
          {{chapter.label}}
        </ion-item>
      </ion-list>
    </ion-content>
  
  </ion-menu>
  
  <!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
  <ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

App.ts:

import { Component, ViewChild } from '@angular/core';
import { Nav, Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HomePage } from '../pages/home/home';
import { TocPage } from '../pages/toc/toc';
import { BookPage } from '../pages/book/book';



@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;
  rootPage:any = BookPage;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}

ibby89 avatar Jun 19 '18 10:06 ibby89

Sorry, my head really is not in this project any more :/ Maybe try asking at http://forum.ionicframework.com/

janpio avatar Jun 19 '18 14:06 janpio

Hi Jan,

Thanks for the reply, I understand. I'll spend some more time on it and see if I can do it myself. I'm also upgrading the code to use ePUBJS v0.3 as well so might as well do it all together if I can.

ibby89 avatar Jul 03 '18 14:07 ibby89

Be aware that there is already a PR for the 0.3 update that should give you a good starting point.

janpio avatar Jul 04 '18 10:07 janpio