Multiple app components in angular

Issue

I am new to angular. I am currently using Meteor+Angular.

I have an app.component.html that looks like this:

<div id="main">
  <nav-user></nav-user>
  <router-outlet></router-outlet>
<div>

I want to support views for both user and admin in the same application (e.g., under /admin and /user). This requires a separate navigation component <nav-admin></nav-admin> when under /admin links.

Is there anyway to do that?

Solution

I think all you need is *ngIf :

<nav-user *ngIf='user.type=="user"'></nav-user>
<nav-admin *ngIf='user.type=="admin"'></nav-admin>

Answered By – Vivek Doshi

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.