title: How can create a dynamic menu in angular 2?
body: <p>I need to create a dynamic menu after user logged in successfully and redirected to home page using Angular 2. Exactly like in the first similar question except I cannot hardcore the menu items.</p>
  
  <p><a href="https://stackoverflow.com/questions/36665094/angular2-using-routes-how-to-display-the-navigation-bar-after-successfully-log">Angular2: Using routes, how to display the navigation bar after successfully logged in?</a></p>
  
  <pre><code>#app.component.html#
  
  &lt;navbar&gt;
      &lt;!--Here I want to create menu items--&gt;
  &lt;/navbar&gt;
  
  &lt;div class="container"&gt;
      &lt;div class="col-sm-12"&gt;
          &lt;router-outlet&gt;&lt;/router-outlet&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="footer" class="inner-wrap"&gt;
      &lt;div class="row no-padding"&gt;
          &lt;div class="col-sm-12 no-padding"&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  **home.component.ts**
  
   import { Component, OnInit } from '@angular/core';
  
   import { User } from '../_models/index';
   import { UserService } from '../_services/index';
  
  @Component({
  //moduleId: module.id,
  templateUrl: 'home.component.html'
   })
  
  export class HomeComponent implements OnInit {
  users: User[] = [];
  
  constructor(private userService: UserService) { }
  
   ngOnInit() {
    &lt;!-- how we can create it here or any better place --&gt;
      // get users from secure api end point
      this.userService.getUsers()
          .subscribe(users =&gt; {
              this.users = users;
          });
     }
  
  }
  </code></pre>
  
  <p>Clearly I am new to this technology. Please anybody pick this up?</p>
  
  <p>Blockquote</p>