import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute } from '@angular/router' ; @ Component ( { selector : 'app-channel' , templateUrl : './channel.component.html' , styleUrls : [ './channel.component.css' ] } ) export class ChannelComponent implements OnInit { public cname : string ; constructor ( private route ) { } ngOnInit ( ) { this . route . params . subscribe ( res => { this . cname = res [ 'name' ] ; } ) ; } }