How to access value of userPass from array of object ?

14 views
Skip to first unread message

ahmed elbarbary

unread,
Jan 11, 2020, 8:28:21 PM1/11/20
to Angular and AngularJS discussion
How to access value of userPass from array of object using angular 7?
I need to access Property userPass from array of object 
I have variable from type any his name auth 
auth have array of object
I need to access property value from userpass
auth is  
 
[{"userLoginID":0,"userName":"test","userMail":"xxxxx@gmail.com","userPass":"12345678","fkTeamID":0  
 
,"isAdmin":false,"createdBy":0,"createdDate":"0001-01-01T00:00:00","isHidden":false}]  

I need to access userPass value meaning i need to access 12345678
so what i do to make that please using angular 7

Arnaud Deman

unread,
Jan 12, 2020, 6:52:20 AM1/12/20
to Angular and AngularJS discussion
Hi Ahmed,

Well this is not Angular specific.
As you can see auth is an array ([...]) which contains an associative array ({...}).
So I would say you can access to the userPass field with auth[0].userPass.

For typescript you can refer to this doc.
For Angular the Tour of Hero tutorial is a good starting point and then the doc on angular.io is really good.

If you don't make this effort you will waste your time and it will be really frustrating.
Another side effect is that people here will stop help you as they really can't learn Angular for you.

This is just an advice don't take it bad.
Regards,
Arnaud.
Reply all
Reply to author
Forward
0 new messages