Cannot get input element value ngFor

Hi all,

I am beginner in angular 2

I develop web chat app using angular 2.Pls refer this http://imgur.com/dpnLSSv

I need dont display repeated value.Because I will check two variable.

below my html code

{{chat.date | amDateFormat:'LL'}}


{{chat.path_text}} {{chat.date | amDateFormat:'hh:mmA'}}
{{chat.message_text}} {{chat.date | amDateFormat:'hh:mmA'}}

So i Bind the chat.date value using input tag.i get input element value using id.below my typescript file.

import { Component, Inject, ViewChild, ElementRef, AfterViewInit } from ‘@angular/core’;

export class ChatPage implements AfterViewInit {
@ViewChild(‘myname’) input: ElementRef;
constructor(public modalCtrl: ModalController, public navCtrl: NavController) { }
ngAfterViewInit() {
console.log(this.input.nativeElement.value);
}
}

i am getting this error

Cannot read property ‘nativeElement’ of undefined

How to fix this issue.or any other way to find slutions.I need same values are does not show.

.I tried to many way.I have no idea.

Kindly Advice me,
Thanks & Regards