-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbasic.ts
More file actions
50 lines (45 loc) · 1020 Bytes
/
Copy pathbasic.ts
File metadata and controls
50 lines (45 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, Component, Input, Injectable } from '@angular/core';
// note: do not put semicolon after @Decorateros
@Component({
selector: 'crap-article',
template: `
<article>
<h2>{{ title }}</h2>
<p>{{ body }}</p>
</article>
`,
styles: ['h2 {color: red} p {color: blue;}']
})
class CrapArticleComponent {
@Input() title;
@Input('text') body;
}
@Component({
selector: 'app-root',
template: `
<h1>{{ title }}</h1>
<crap-article title="Breaking News" text="Billions of dollars was made today."></crap-article>
<ul>
<li *ngFor="let i of list">item number {{ i }}</li>
</ul>`,
styles: ['li { background: cyan; }']
})
class AppComponent {
title = 'List of things';
list = ['Foo', 'Bar', 'Baz'];
}
@Injectable()
class HeroService {}
@NgModule({
declarations: [
AppComponent,
CrapArticleComponent
],
imports: [
BrowserModule
],
providers: [HeroService],
bootstrap: [AppComponent]
})
export class AppModule { }