简体   繁体   English

如何在angular中拨打Rest API

[英]How to call Rest API in angular

The Rest API consumes JSON input as below and produces JSON response. Rest API 使用如下 JSON 输入并产生 JSON 响应。

    {
       "addressObject":{
       "streetAddressLine": "abc",
       "city": "xyz" ,
       "state": "ghi" ,
       "zip" : "123"
       }
    }

I have a angular project with below code in app.component.html:我有一个 angular 项目,在 app.component.html 中包含以下代码:

    <input type="text" name="streetAddressLine">
    <input type="text" name="city">
    <input type="text" name="state">
    <input type="text" name="zip">
    <input type="submit" value="Execute">

After filling above details whenever i click on 'Execute', my angular application should make a call to Rest API and pass above data as JSON input to the Rest API. How to implement this?每当我点击“执行”填写以上详细信息后,我的 angular 应用程序应该调用 Rest API 并将以上数据作为 JSON 输入传递给 Rest API。如何实现这个?

I am new to Angular.我是 Angular 的新用户。

Go through this Tutorial, it teaches CRUD operations in Angular. Angular CRUD . Go 通过这个Tutorial,教授CRUD操作 Angular Angular CRUD It is beginner friendly too.它对初学者也很友好。

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

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