Skip to content

Commit 35bafa7

Browse files
BaggersIOrobinboehm
authored andcommitted
Create a BookEdit Component
1 parent fff77a2 commit 35bafa7

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div *ngIf="book">
22
<h2>{{book.title}} by <small>{{book.author}}</small></h2>
33
<h3>{{book.subtitle}}</h3>
4+
<a [routerLink]="['edit']">Edit</a>
45
</div>

src/app/book/book-edit/book-edit.component.css

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h2>Edit</h2>
2+
<form>
3+
4+
</form>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'book-edit',
5+
templateUrl: './book-edit.component.html',
6+
styleUrls: ['./book-edit.component.css']
7+
})
8+
export class BookEditComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}

src/app/book/book-routing.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { BookComponent } from './book.component';
44
import { BookListComponent } from './book-list/book-list.component';
55
import { BookDetailComponent } from './book-detail/book-detail.component';
66
import { ConfirmCandeactivateGuardService } from './shared/confirm-candeactivate-guard.service';
7+
import { BookEditComponent } from './book-edit/book-edit.component';
78

89
export const routes: Routes = [{
910
path: '',
@@ -15,6 +16,9 @@ export const routes: Routes = [{
1516
path: ':isbn',
1617
component: BookDetailComponent,
1718
canDeactivate: [ConfirmCandeactivateGuardService]
19+
}, {
20+
path: ':isbn/edit',
21+
component: BookEditComponent,
1822
}]
1923
}];
2024

src/app/book/book.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ import { BookDetailComponent } from './book-detail/book-detail.component';
77
import { HttpModule } from '@angular/http';
88
import { BookRoutingModule } from './book-routing.module';
99
import { ConfirmCandeactivateGuardService } from './shared/confirm-candeactivate-guard.service';
10+
import { BookEditComponent } from './book-edit/book-edit.component';
11+
import { FormsModule } from '@angular/forms';
1012

1113

1214
@NgModule({
1315
imports: [
1416
BookRoutingModule,
1517
HttpModule,
18+
FormsModule,
1619
CommonModule
1720
],
1821
declarations: [
1922
BookComponent,
2023
BookListComponent,
21-
BookDetailComponent
24+
BookDetailComponent,
25+
BookEditComponent
2226
],
2327
providers: [
2428
BookDataService,

0 commit comments

Comments
 (0)