Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Commit 40ec85d

Browse files
author
Gregor Woiwode
committed
Adds template to component book
1 parent 9f2a2d1 commit 40ec85d

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<p>
2-
book works!
3-
</p>
1+
<div class="well">
2+
<div class="thumbnail pull-right">
3+
<img src="//gravatar.com/avatar/{{ information.rating }}?s=80&default=wavatar" />
4+
</div>
5+
<h2>{{ information.title }} <small>Stars {{ information.rating }}</small></h2>
6+
<p>{{ information.description }}</p>
7+
</div>
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit, Input } from '@angular/core';
2+
import { Book } from '../shared';
23

34
@Component({
45
moduleId: module.id,
5-
selector: 'app-book',
6+
selector: 'br-book',
67
templateUrl: 'book.component.html',
78
styleUrls: ['book.component.css']
89
})
9-
export class BookComponent implements OnInit {
10+
export class BookComponent {
11+
@Input() information: Book;
1012

11-
constructor() {}
12-
13-
ngOnInit() {
13+
constructor() {
1414
}
15-
1615
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<h1>Books</h1>
2-
<div>
3-
{{ books }}
4-
</div>
2+
3+
<br-book [information]="book"></br-book>
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { BookComponent } from '../book';
3+
import { Book } from '../shared';
24

35
@Component({
46
moduleId: module.id,
57
selector: 'br-dashboard',
68
templateUrl: 'dashboard.component.html',
7-
styleUrls: ['dashboard.component.css']
9+
styleUrls: ['dashboard.component.css'],
10+
directives: [BookComponent]
811
})
912
export class DashboardComponent implements OnInit {
1013

11-
books: string[];
14+
book: Book;
1215

1316
constructor(){}
1417

1518
ngOnInit() {
16-
this.books = ['Angular 2', 'Aurelia'];
19+
this.book = new Book('Bericht DWX 2016', 'Das haben wir erlebt');
1720
}
1821

1922
}

0 commit comments

Comments
 (0)