Add component for the header bar

This commit is contained in:
Gergely Polonkai 2016-10-28 07:44:47 +02:00
parent e2a3332d82
commit e7c883ae98
4 changed files with 42 additions and 1 deletions

View File

@ -1,3 +1,4 @@
<duckbook-header></duckbook-header>
<a routerLink="/dashboard">Dashboard</a> <a routerLink="/dashboard">Dashboard</a>
<a routerLink="/ducks">Ducks</a> <a routerLink="/ducks">Ducks</a>
<router-outlet></router-outlet> <router-outlet></router-outlet>

View File

@ -12,6 +12,7 @@ import { AppComponent } from "./app.component";
import { DuckDetailComponent } from "./duck-detail.component"; import { DuckDetailComponent } from "./duck-detail.component";
import { DashboardComponent } from "./dashboard.component"; import { DashboardComponent } from "./dashboard.component";
import { DucksComponent } from "./ducks.component"; import { DucksComponent } from "./ducks.component";
import { HeaderComponent } from "./header.component";
import { DuckService } from "./duck.service"; import { DuckService } from "./duck.service";
import { UserService } from "./user.service"; import { UserService } from "./user.service";
@ -27,7 +28,8 @@ import { UserService } from "./user.service";
AppComponent, AppComponent,
DashboardComponent, DashboardComponent,
DuckDetailComponent, DuckDetailComponent,
DucksComponent DucksComponent,
HeaderComponent
], ],
providers: [ providers: [
DuckService, DuckService,

26
app/header.component.html Normal file
View File

@ -0,0 +1,26 @@
<header>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button"
class="navbar-toggle collapsed"
data-toggle="collapse"
data-target="#duckbook-header-inner"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Rubber Duck Booking Tool</a>
</div>
<div class="collapse navbar-collapse" id="duckbook-header-inner">
<ul class="nav navbar-nav navbar-right">
<li *ngIf="!userService.currentUser">
<a href="#">Login</a>
</li>
</ul>
</div>
</div>
</nav>
</header>

12
app/header.component.ts Normal file
View File

@ -0,0 +1,12 @@
import { Component } from "@angular/core";
import { UserService } from "./user.service";
@Component({
moduleId: module.id,
selector: "duckbook-header",
templateUrl: "header.component.html"
})
export class HeaderComponent {
constructor(private userService: UserService) {}
}