Link to home
Create AccountLog in
Avatar of Steve Hougom
Steve HougomFlag for United States of America

asked on

Need help mapping array of number strings ["1","2"] to text descriptions

In my Angular 11 typescript code I am getting back a few fields  from the API in this format.  
User generated image

In my call to assign the response to a local var i need to swap those above values out and replace them with meaningful descriptions such as:  "some description" instead of the numbers strings.

Here is my call to get data.  
User generated image

Avatar of leakim971
Flag of Guadeloupe image

const eligibility = {
   1: "desc1",
   2: "desc2",
   3: "desc3",
   4: "desc4",
const items = => eligibilty[x]);

Open in new window

Avatar of Steve Hougom


Having some trouble making this work.  Im trying to alter my local typescript model class called FormData.
you can see the eligibility field in there.  So when I get the response I assign it to this FormData Class.  You can see the response in a previous message screenshot.  

User generated image
User generated image

User generated image
Avatar of Steve Hougom
Steve Hougom
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account