我需要在用户成功登录并使用Angular 2重定向到主页后创建一个动态菜单.完全像第一个类似的问题,除了我不能硬核菜单项.
#app.component.html#
<navbar>
<!--Here I want to create menu items-->
</navbar>
<div class="container">
<div class="col-sm-12">
<router-outlet></router-outlet>
</div>
</div>
<div id="footer" class="inner-wrap">
<div class="row no-padding">
<div class="col-sm-12 no-padding">
</div>
</div>
</div>
**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() {
<!-- how we can create …Run Code Online (Sandbox Code Playgroud)