Created
April 20, 2017 19:29
-
-
Save sajeetharan/11671d24b3634606a56231bd390bdb2a to your computer and use it in GitHub Desktop.
user listing container.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, SimpleChanges } from '@angular/core'; | |
import { ListingService } from '../../../services/listing.service'; | |
import { ListingDAO } from '../../../../seller/domain/listingDao'; | |
@Component({ | |
moduleId: module.id, | |
selector: 'listing-container', | |
templateUrl: 'listing-container.component.html' | |
}) | |
export class ListingContainerComponent implements OnInit { | |
listings: ListingDAO[] = new Array<ListingDAO>(); | |
userId: string; | |
countofAll: number; | |
errorMessage: string; | |
constructor(private listingService: ListingService) { } | |
ngOnInit() { | |
console.log('session storage is' + JSON.stringify(window.sessionStorage)); | |
this.userId = window.sessionStorage.getItem('TCMBO_Login_UID'); | |
this.listingService.getListings(this.userId).subscribe(resultlisting => { | |
this.listings = resultlisting; | |
}, error => this.errorMessage = error); | |
} | |
ngOnChanges(changes: SimpleChanges) { | |
if (this.listings) { | |
this.countofAll = this.listings.length; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment