0

I've been try to think about a way to about this, can't just think about anything yet.

Quickly: I have a project which consists of two channels. One for the admin, the other for the staffs, The app automatically takes you the right channel depending on whether the variable from your database info says (admin: "true") or (admin: "false") respectively.

the staffs uses a tab menu. that's not a problem.

But I want the admin to use a side menu. The Question: How do I create a side menu inside of the admin page. I've read the ionic 3 docs, but it's not been of much help because the side menu is created from the app.component. But mine is inside a child page.

So please any help would be greatly appreciated.

user3118363
  • 337
  • 4
  • 13

1 Answers1

0

Just setup your pages in the app.component.ts, as you would normally and in your child view add something like the following:

<ion-header>
  <ion-navbar>
    <button ion-button menuToggle *ngIf="this.admin">
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Title of your child view</ion-title>
  </ion-navbar>
</ion-header>

Assuming this.admin is a boolean stating whether your user is an admin or not.

And I guess you are aware that checking a users authorisation on the client side is not safe at all. I mean you can just debug the code and change this.admin to true anyway.

Phonolog
  • 6,321
  • 3
  • 36
  • 64
  • Great, Thanks, I got it working. I'm working with nodeJS, so you advice I should check the authorization on node? Also, I test my app with ionic run android --device. But it's too slow. I've tried using the -l flag and (--livereload) flag. It still doesn't work/ Is there any faster way of testing my app quicker ? – user3118363 Feb 24 '18 at 15:45
  • I just wanted to point out, that you can't trust anything on the client side and therefore you should not rely on a client sending you the information that he's an admin... I'm mostly using `ionic serve` to test my app in the browser. – Phonolog Feb 24 '18 at 16:31
  • I'm not relying on the client side, I'm actually retrieving the information from the database using a login service. then I pass the data into the component.ts, that's shere i do all my checks and response – user3118363 Feb 24 '18 at 16:38
  • 2
    Even better! I just wanted to note it, in case you didn't know... Feel free to accept and/or upvote my answer if it helped anyway :) – Phonolog Feb 25 '18 at 14:54