import { Component , OnInit , ViewChild } from '@angular/core' ; import { Router } from '@angular/router' ; import { LocalStorageService } from 'ng2-webstorage' ; import { Animations , AnimationsService } from '../../shared/' ; @ Component ( { selector : 'app-entry' , templateUrl : './entry.component.html' , styleUrls : [ './entry.component.scss' ] , } ) export class EntryComponent extends Animations implements OnInit { @ ViewChild ( 'nickControl' ) nickControl : any ; param { AnimationsService } animationsService param { LocalStorageService } localStorage param { Router } router public constructor ( protected animationsService , private localStorage , private router ) { super ( animationsService ) ; } see https public ngOnInit ( ) { } param { string } nick public enterNick ( nick ) { this . localStorage . store ( 'nick' , nick ) ; this . router . navigate ( [ '/chat' ] ) ; } }