-
Notifications
You must be signed in to change notification settings - Fork 2
/
friends.ts
63 lines (58 loc) · 1.95 KB
/
friends.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {bootstrap, Foreach} from 'angular2/angular2';
import {Component, Template} from 'annotations';
interface Friend {
name: string;
age: number;
howWeMet: string;
whereWeMet: string;
showDetails: boolean;
}
@Component({
selector: 'friends-app',
componentServices: []
})
@Template({
url: 'friends.html',
directives: [Foreach]
})
class FriendsApp {
friends: Array<Friend>;
toggleDetails(friend: Friend) {
friend.showDetails = !friend.showDetails;
}
constructor() {
this.friends = [
{
name: "John",
age: 31,
whereWeMet: "Vancouver",
howWeMet: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vulputate nisl in faucibus viverra. Aenean ex orci, porta quis sapien nec, efficitur volutpat mi.",
showDetails: false
},
{
name: "Jane",
age: 34,
whereWeMet: "Montreal",
howWeMet: "Morbi vitae enim ut turpis sollicitudin fermentum. Aliquam odio erat, ornare eu neque ut, lacinia blandit neque. Vivamus hendrerit molestie felis et egestas.",
showDetails: false
},
{
name: "Frank",
age: 29,
whereWeMet: "Tokyo",
howWeMet: "Suspendisse potenti. Nulla facilisi. Aliquam molestie consectetur egestas. Donec nec leo eu quam egestas dignissim.",
showDetails: false
},
{
name: "Carol",
age: 39,
whereWeMet: "Paris",
howWeMet: "Suspendisse sed mauris suscipit elit tincidunt imperdiet vitae et nunc. Praesent dictum iaculis risus facilisis ultrices. Etiam a maximus massa, ac condimentum nisi.",
showDetails: false
}
];
}
}
export function main () {
bootstrap(FriendsApp);
}