-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcard.component.ts
More file actions
63 lines (57 loc) · 1.53 KB
/
card.component.ts
File metadata and controls
63 lines (57 loc) · 1.53 KB
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 {Input, Component} from "@angular/core";
import {ContactService} from "../services/contact.service";
@Component({
selector: 'ccCard',
template: `<div class="col-md-6">
<div class="well well-sm">
<div class="row">
<div class="col-md-4">
<img src="{{ user.photo | defaultImage }}"
alt=""
class="img-rounded img-responsive" />
</div>
<div class="col-md-8">
<h4>{{ user.name }}
<i class="fa"
[ngClass]="{'fa-female':user.sex == 'F', 'fa-male': user.sex == 'M'}"></i>
</h4>
<small>{{ user.city }}, {{ user.country }}
<i class="fa fa-map-marker"></i>
</small>
<p>
<i class="fa fa-envelope-o"></i>
{{ user.email }}
<br />
<i class="fa fa-gift"></i>
{{ user.birthdate | date:"longDate"}}
</p>
<a class="btn btn-default btn-sm"
[attr.href]="'#!/edit/' + user.email">
<i class="fa fa-pencil"></i>
Edit
</a>
<a class="btn btn-danger btn-sm"
[ladda]="isDeleting"
(click)="deleteUser()">
<i class="fa fa-trash"></i>
Delete
</a>
</div>
</div>
</div>
</div>
`
})
export class CardComponent {
@Input()
public user;
public isDeleting = false;
constructor(private contactService: ContactService) {
}
deleteUser() {
this.isDeleting = true;
this.contactService.removeContact(this.user).then(() => {
this.isDeleting = false;
});
};
}