File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 11< ul class ="collection ">
2- < li class ="collection-item avatar " *ngFor ="let contact of contacts ">
2+ < li class ="collection-item avatar " *ngFor ="let contact of contacts | async ">
33 < a [routerLink] ="['/contact', contact.id] ">
44 < img [src] ="contact.image " alt ="" class ="circle ">
55 < span class ="title "> {{contact.name}}</ span >
Original file line number Diff line number Diff line change 11import { Component , OnInit } from '@angular/core' ;
2+ import { Observable } from 'rxjs/Observable' ;
23import { ContactsService } from '../contacts.service' ;
34import { Contact } from '../models/contact' ;
45
@@ -9,13 +10,12 @@ import { Contact } from '../models/contact';
910} )
1011export class ContactsListComponent implements OnInit {
1112
12- contacts : Array < Contact > ;
13+ contacts : Observable < Array < Contact > > ;
1314
1415 constructor ( private contactsService : ContactsService ) { }
1516
1617 ngOnInit ( ) {
17- this . contactsService . getContacts ( )
18- . subscribe ( contacts => this . contacts = contacts ) ;
18+ this . contacts = this . contactsService . getContacts ( ) ;
1919 }
2020
2121}
You can’t perform that action at this time.
0 commit comments