-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patharticle.component.ts
More file actions
39 lines (33 loc) · 1003 Bytes
/
article.component.ts
File metadata and controls
39 lines (33 loc) · 1003 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
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
import { DevCommunityRssItem } from '../dev-community-rss-parser.token';
const selector = '[til-article]';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector,
template: `
<h2>
<a [href]="rssItem?.link" target="_blank" rel="nofollow noopener">{{
rssItem?.title
}}</a>
</h2>
<footer>
<p>
By {{ rssItem?.author }}<br />
<time [dateTime]="rssItem?.isoDate">{{
rssItem?.isoDate | date: 'long'
}}</time
><br />
<span *ngFor="let tag of rssItem?.categories">#{{ tag }} </span>
</p>
</footer>
<p>{{ rssItem?.contentSnippet | tilTruncate }}</p>
<a [href]="rssItem?.link" target="_blank" rel="nofollow noopener"
>Read article</a
>
`,
})
export class ArticleComponent {
@Input()
rssItem: DevCommunityRssItem | null = null;
}