File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
ASP.NET Core Basics/src/Aurelia/ClientApp/app/components Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export class App {
3737 title : 'Contact List'
3838 } ,
3939 {
40- route : 'contact-detail/:id' ,
40+ route : 'contact-detail/:id? ' ,
4141 name : 'contactdetail' ,
4242 moduleId : '../contacts/contactDetail' ,
4343 nav : false ,
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ <h1>Contact Details</h1>
1515 < dd > ${contact.email}</ dd >
1616 </ dl >
1717 </ div >
18+ < h3 if.bind ="!hasContactId ">
19+ Place holder for creating a new contact
20+ </ h3 >
1821 < a route-href ="route: contactlist "> Back to List</ a >
1922 < hr />
2023</ template >
Original file line number Diff line number Diff line change @@ -5,12 +5,20 @@ import { ContactService } from './contactService';
55@inject ( ContactService )
66export class ContactDetail {
77 contact : Contact ;
8+ hasContactId : boolean ;
89
910 constructor ( private contactService : ContactService ) { }
1011
1112 activate ( parms , routeConfig ) {
12- return this . contactService . getById ( parms . id )
13- . then ( contact => this . contact = contact ) ;
13+ this . hasContactId = parms . id ;
14+
15+ if ( this . hasContactId ) {
16+ return this . contactService . getById ( parms . id )
17+ . then ( contact => this . contact = contact ) ;
18+ }
19+
20+ return null ;
21+
1422 }
1523
1624}
Original file line number Diff line number Diff line change 22 < h1 > Contact List</ h1 >
33
44 < p if.bind ="!contacts "> < em > Loading...</ em > </ p >
5+
6+ < a route-href ="route: contactdetail "> Create New Contact</ a >
57
68 < table class ="table " if.bind ="contacts ">
79 < thead >
You can’t perform that action at this time.
0 commit comments