How can I retrieve the userPass value from an array of objects using Angular 7?
I am looking to access the userPass property value from an array of objects.
I have a variable named auth of type any.
The auth variable contains an array of objects.
I want to extract the userPass value from the JSON below:
var auth;
auth = [{"userLoginID":0,"userName":"test","userMail":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6b7bebbb3b2a5b7f8b7acbfacf8b4b796b1bbb7bfbaf8b5b9bb">[email protected]</a>","userPass":"12345678","fkTeamID":0,"isAdmin":false,"createdBy":0,"createdDate":"0001-01-01T00:00:00","isHidden":false}]
I need to access the userPass value, which is 12345678.
This is what I have tried:
ngOnInit() {
auth.forEach(element => {
element.forEach(au => {
console.log(au.userPass);
});
});
userpathvalue=???;
}
Basically, I need to retrieve the value 12345678.