locked
How to access value of userPass from array of object using angular 7? RRS feed

  • Question

  • User696604810 posted

    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 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

    Sunday, January 12, 2020 1:30 AM

Answers

  • User-474980206 posted

    in modern javascript its:

       const userPass = auth[0]?.userpass;

    I assume your issue is typescript (which I don't use). define an interface with userPass as a string properties, than do a cast of auth[0].

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 12, 2020 8:30 PM