【发布时间】:2020-12-25 08:45:24
【问题描述】:
我在后端 ( Spring boot ) 上有一个 post 方法,当我发布数据时返回 id。
@RequestMapping(value="/fncs", method=RequestMethod.POST)
public int addFnc(@RequestBody Fnc fnc){
fncservice.addFnc(fnc);
return fnc.getN_fnc();
}
我想在 Angular 服务中创建一个返回 id (number) 的函数,我用这个函数尝试过,但没有成功。
const baseUrl = 'http://192.168.100.9:8081/fncs';
create(data): Observable<any> {
return this.http.post(baseUrl, data);
}
【问题讨论】:
标签: angular spring-boot