Accessing JSON data with colon in the label

后端 未结 2 676
小蘑菇
小蘑菇 2021-01-19 22:02

I have json data with a colon in the label (see responsedata) which I\'m finding difficult to access in Angular with the following code:

  • 2条回答
    •  半阙折子戏
      2021-01-19 22:52

      Use brackets to access it like a dictionary rather than dot notation. Replace {{i.autn:numhits}} with {{i['autn:numhits']}}

      As a heads up, if you want to wrap autn:numhits with double quotes you will need to html escape them.

    提交回复
    热议问题