Skip to content

Commit 4d9fb96

Browse files
BaggersIOrobinboehm
authored andcommitted
Create a title @input
1 parent 522d1dc commit 4d9fb96

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

src/app/app.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ <h1>
55
<info-box></info-box>
66

77
<mouse-cursor></mouse-cursor>
8+
9+
<title-box [title]="title"></title-box>
10+
<title-box title="foo"></title-box>

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import { HttpClientModule } from '@angular/common/http';
66
import { AppComponent } from './app.component';
77
import { InfoBoxComponent } from './info-box/info-box.component';
88
import { MouseCursorComponent } from './mouse-cursor/mouse-cursor.component';
9+
import { TitleBoxComponent } from './title-box/title-box.component';
910

1011
@NgModule({
1112
declarations: [
1213
AppComponent,
1314
InfoBoxComponent,
14-
MouseCursorComponent
15+
MouseCursorComponent,
16+
TitleBoxComponent
1517
],
1618
imports: [
1719
BrowserModule,

src/app/title-box/title-box.component.css

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h3>{{title}}</h3>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Component, OnInit, Input } from '@angular/core';
2+
3+
@Component({
4+
selector: 'title-box',
5+
templateUrl: './title-box.component.html',
6+
styleUrls: ['./title-box.component.css']
7+
})
8+
export class TitleBoxComponent implements OnInit {
9+
10+
@Input()
11+
title: string = '';
12+
13+
constructor() { }
14+
15+
ngOnInit() {
16+
}
17+
18+
}

0 commit comments

Comments
 (0)