-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.component.ts
48 lines (36 loc) · 975 Bytes
/
test.component.ts
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
import {Component, OnInit} from '@angular/core';
import {Feed, GenObject, ObituaryObject, ReactionObject} from '../model/Model';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
reactionObject: Feed;
obituaryObject: Feed;
constructor() {
console.log('constructing');
}
ngOnInit(): void {
const object = new ReactionObject('action',
'username',
1,
'cat');
this.reactionObject = new Feed('type', object);
const object2 = new ObituaryObject('today',
'francesca',
1,
'2');
this.obituaryObject = new Feed('type2', object2);
}
getReaction(object: GenObject) {
if (object instanceof ReactionObject) {
return object as ReactionObject;
}
}
getObituary(object: GenObject) {
if (object instanceof ObituaryObject) {
return object as ObituaryObject;
}
}
}