Typescript Map throwing error while using its functions (mapobject.keys() is not a function)

后端 未结 1 554
谎友^
谎友^ 2021-02-20 04:28

I am a new bee in typescript , In my angular4 project I am receiving a map object as a json.

so I declared a class that is given bellow

 

        
1条回答
  •  醉梦人生
    2021-02-20 05:02

    You can get the values using key like this:

    for (const key in formConfig) {
      console.log('The value for ' + key + ' is = ' + formConfig[key]);
    }
    

    And getting array of the Object's key values is done like this:

    keys: string [] = Object.keys(formConfig);
    

    0 讨论(0)
提交回复
热议问题