Skip to content

Commit 9398697

Browse files
committed
Finish getting Aurelia functionality matching Angular 2. Also moved CSS from Angular 2 into the site.css.
1 parent ab90552 commit 9398697

File tree

13 files changed

+87
-58
lines changed

13 files changed

+87
-58
lines changed

src/ASP.NET-Core-SPAs/Angular/app.component.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ASP.NET-Core-SPAs/Angular/app.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ASP.NET-Core-SPAs/Angular/app.component.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,6 @@ import 'rxjs/Rx';
1919
</ul>
2020
<contact-detail [contact]="selectedContact"></contact-detail>
2121
`,
22-
styles: [`
23-
.selected {
24-
background-color: #CFD8DC !important;
25-
color: white;
26-
}
27-
.contacts {
28-
margin: 0 0 2em 0;
29-
list-style-type: none;
30-
padding: 0;
31-
width: 10em;
32-
}
33-
.contacts li {
34-
cursor: pointer;
35-
position: relative;
36-
left: 0;
37-
background-color: #EEE;
38-
margin: .5em;
39-
padding: .3em 0em;
40-
height: 1.6em;
41-
border-radius: 4px;
42-
}
43-
.contacts li.selected:hover {
44-
color: white;
45-
}
46-
.contacts li:hover {
47-
color: #607D8B;
48-
background-color: #EEE;
49-
left: .1em;
50-
}
51-
.contacts .text {
52-
position: relative;
53-
top: -3px;
54-
}
55-
.contacts .badge {
56-
display: inline-block;
57-
font-size: small;
58-
color: white;
59-
padding: 0.8em 0.7em 0em 0.7em;
60-
background-color: #607D8B;
61-
line-height: 1em;
62-
position: relative;
63-
left: -1px;
64-
top: -4px;
65-
height: 1.8em;
66-
margin-right: .8em;
67-
border-radius: 4px 0px 0px 4px;
68-
}
69-
`],
7022
directives: [ContactDetailComponent],
7123
providers: [
7224
HTTP_PROVIDERS,

src/ASP.NET-Core-SPAs/Angular/contact-detail.component.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ASP.NET-Core-SPAs/Angular/contact-detail.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ASP.NET-Core-SPAs/Angular/contact-detail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import {Contact} from './contact';
1313
</div>
1414
<div>
1515
<label>Email: </label>
16-
<div><input [(ngModel)]="contact.Email" placeholder="email"></div>
16+
<div><input [(ngModel)]="contact.EmailAddress" placeholder="email"></div>
1717
</div>
1818
<div>
1919
<label>Phone: </label>
20-
<div><input [(ngModel)]="contact.Phone" placeholder="phone"></div>
20+
<div><input [(ngModel)]="contact.PhoneNumber" placeholder="phone"></div>
2121
</div>
2222
</div>
2323
`,

src/ASP.NET-Core-SPAs/wwwroot/Angular/app/contact-detail.component.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<template>
2+
<require from='./contact-detail'></require>
23
<h1>${heading}</h1>
34
<div>
4-
<ul class="list-unstyled">
5-
<li repeat.for="contact of contacts">
5+
<ul class="contacts">
6+
<li repeat.for="contact of contacts" click.delegate="$parent.select(contact)"
7+
class="${contact === $parent.selectedContact ? 'selected' : ''}">
68
<span class="badge">${contact.Id}</span> ${contact.Name}
79
</li>
810
</ul>
911
</div>
12+
<contact-detail contact.bind="selectedContact"></contact-detail>
1013
</template>

src/ASP.NET-Core-SPAs/wwwroot/Aurelia/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {ContactService} from 'contactService';
44
export class ContactList {
55
static inject = [ContactService];
66
heading = 'Contact List';
7+
selectedContact = null;
78

89
constructor (cs) {
910
this.ContactService = cs;
@@ -13,5 +14,9 @@ export class ContactList {
1314
this.ContactService.GetAll()
1415
.then(contacts => this.contacts = contacts);
1516
}
17+
18+
select(contact) {
19+
this.selectedContact = contact;
20+
}
1621

1722
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template bindable="contact">
2+
<div if.bind="contact">
3+
<h2>${contact.Name}</h2>
4+
<div><label>ID: </label>${contact.Id}</div>
5+
<div>
6+
<label>Name: </label>
7+
<div><input value.bind="contact.Name" placeholder="name"></div>
8+
</div>
9+
<div>
10+
<label>Email: </label>
11+
<div><input value.bind="contact.EmailAddress" placeholder="email"></div>
12+
</div>
13+
<div>
14+
<label>Phone: </label>
15+
<div><input value.bind="contact.PhoneNumber" placeholder="phone"></div>
16+
</div>
17+
</div>
18+
</template>

0 commit comments

Comments
 (0)