Skip to content

Instantly share code, notes, and snippets.

@sajeetharan
Created April 20, 2017 19:29
Show Gist options
  • Save sajeetharan/11671d24b3634606a56231bd390bdb2a to your computer and use it in GitHub Desktop.
Save sajeetharan/11671d24b3634606a56231bd390bdb2a to your computer and use it in GitHub Desktop.
user listing container.ts
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