Skip to content
Loading
How to access value of userPass from array of object ?
  • Laxmidhar Sahoo
    try it
    for (let temp of arr) {
    console.log(tmp.userPass);
    }
  • thank you for reply
    it give me error when apply 
    1.  ngOnInit() {  
    2. arr.forEach(function (value) {    
    3.   console.log(value.userPass);    
    4. });    
    5. }  
     
    auth.forEach is not a function
    at ChangepasswordComponent.ngOnInit (changepassword.component.ts:67)
    at checkAndUpdateDirectiveInline (core.js:31910)
    at checkAndUpdateNodeInline (core.js:44367)
    at checkAndUpdateNode (core.js:44306)
    at debugCheckAndUpdateNode (core.js:45328)
    at debugCheckDirectivesFn (core.js:45271)
    at Object.eval [as updateDirectives] (ChangepasswordComponent_Host.ngfactory.js? [sm]:1)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:45259)
    at checkAndUpdateView (core.js:44271)
    at callViewAction (core.js:44637)
     
  • Laxmidhar Sahoo
    1. var arr = [{"userLoginID":0,"userName":"test","userMail":"[email protected]","userPass":"12345678","fkTeamID":0    
    2.     
    3. ,"isAdmin":false,"createdBy":0,"createdDate":"0001-01-01T00:00:00","isHidden":false}]  ;  
    4.   
    5. arr.forEach(function (value) {  
    6.   console.log(value.userPass);  
    7. });