简体   繁体   English

如何通过Angular获取API的控制台output的数据?

[英]How to get the data from the console output of API through Angular?

I am currently working on a full stack project using asp.net and angularjs.I have written this code to get output response from the Swagger API. ( https://i.stack.imgur.com/vLyIE.png ) I have done the API designing through ASP. I am currently working on a full stack project using asp.net and angularjs.I have written this code to get output response from the Swagger API. ( https://i.stack.imgur.com/vLyIE.png ) I have done the API通过ASP设计。 Net.网。 ( https://i.stack.imgur.com/DQkHS.png ) ( https://i.stack.imgur.com/DQkHS.png )

I want to know how I can fetch the details under "data".我想知道如何获取“数据”下的详细信息。 What should be the code for this?这应该是什么代码?

Please help me with the code to display the details under "data" in the response ie, id, created Date etc.

I would define a variable that is equal to the response data as such我会定义一个等于响应数据的变量

const data = successResponse.data;

then you could map over the data using data.map(val => { // do something with the value })然后你可以 map 使用data.map(val => { // do something with the value })

Or you could run a for loop, or execute the forEach method.或者您可以运行 for 循环,或执行 forEach 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM