【发布时间】:2019-05-11 03:59:31
【问题描述】:
我期待在网址中附加股票名称的网络核心。代码如下:
[Route("api/[controller]")]
[ApiController]
public class StockController : ControllerBase
{
private static readonly Random generator = new Random();
// GET api/stock/aapl
[HttpGet("{r}")]
public ActionResult<float[]> Get(
string r,
我不确定 Angular get 中的格式。这就是我所拥有的:
getStock(name: string) {
// url should be api/stock/aapl
console.log("this.http.get<Cagr[]>(this.apiURL + '/api/stock' + {name});", this.http.get<Cagr[]>(this.apiURL + '/api/stock' + {name}))
return this.http.get<Cagr[]>(this.apiURL + '/api/stock' + {name});
}
后端和前端都编译。 console.log 语句将此发送到控制台,格式不准确:
console.log("this.http.get<Cagr[]>(this.apiURL + '/api/stock' + {name});", this.http.get<Cagr[]>(this.apiURL + '/api/stock' + {name}))
我应该使用什么格式?
【问题讨论】:
标签: angular asp.net-core