here is my html
<div class="page">
<paper-card heading="Login Form">
<div class="card-content">
<paper-input [(ngModel)]="user.username" label="Username"></paper-input>
<paper-input [(ngModel)]="user.password" label="Password" type="password"></paper-input>
</div>
<div class="card-actions" align="end">
<paper-button class="login" id="Login" raised disabled (click)="Login(user)">Login</paper-button>
</div>
</paper-card>
</div>
<paper-dialog id="wrong" modal>
<p>Your username or password wrong please check again.</p>
<div class="buttons">
<paper-button dialog-confirm autofocus>Ok..</paper-button>
</div>
</paper-dialog>
here is my full code, when im trying to get array from http res its show undefined
Login(user){
this._httpprovider.httpReq('http://localhost:5000/user','POST',{username:user.username, password:user.password},null).subscribe((data)=>{
if (data.length > 0 ){
this._userdetails.setDetails(data);
this._router.navigate(['MainMenu']);
console.log(data.name); <<<<<<< here is the part
}else {
var wmodal :any = document.getElementById('wrong');
wmodal.open();
}
});
}
but if im doing the console.log(data);
it shows the result
Array[1]
0
:
Object
Name
:
"Admin"
Password
:
"Admin"
SBU
:
"IT"
Updateon
:
"2016-12-21T17:50:21.393Z"
UserName
:
"Admin"
__proto__
:
Object
length
:
1
__proto__
:
Array[0]
here is the array i get from http req
[{"UserName":"Admin","Password":"Admin","Name":"Admin","SBU":"IT","Updateon":"2016-12-21T17:50:21.393Z"}]
what i want to get is the name = admin
so thats why im doing console.log(data.name)


testmethod? Please add more code