# Cannot get input element value ngFor

**URL:** <https://forum.ionicframework.com/t/cannot-get-input-element-value-ngfor/83231>\
**Category:** ionic-v3\
**Created:** [March 17, 2017, 4:06am UTC](https://forum.ionicframework.com/t/cannot-get-input-element-value-ngfor/83231 "2017-03-17T04:06:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anivaishu](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@anivaishu](https://forum.ionicframework.com/u/anivaishu)\
**Post date:** [March 17, 2017, 4:06am UTC](https://forum.ionicframework.com/t/cannot-get-input-element-value-ngfor/83231/1 "2017-03-17T04:06:54Z")

</div>

Hi all,

I am beginner in angular 2

I develop web chat app using angular 2.Pls refer this [http://imgur.com/dpnLSSv](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
