import { Component , OnInit } from '@angular/core' ; import { GithubService } from '../shared/github.service' ; import { Observable } from 'rxjs/Observable' ; import { ActivatedRoute } from '@angular/router' ; @ Component ( { selector : 'repo-list' , styleUrls : [ './repo-list.component.css' ] , templateUrl : './repo-list.component.html' , } ) export class RepoListComponent implements OnInit { org : string ; repos : Observable < any > ; constructor ( public github , private route ) { } ngOnInit ( ) { this . route . params . subscribe ( params => { this . org = params [ 'org' ] ; if ( this . org ) { this . repos = this . github . getReposForOrg ( this . org ) ; } } ) ; } }