Angular4 - post form data to rest api

后端 未结 4 1188
星月不相逢
星月不相逢 2020-12-23 23:50

How is it possible to post form data to an external rest api?

At the moment i have an html form:

4条回答
  •  遥遥无期
    2020-12-24 00:05

    Let me contribute to the accepted answer since I don't have enough reputation to comment. Rather than pick all the form inputS one by one into a model, you could do the following

    var model = this.forContollname.value
    

    Then you could call the following

     var values = JSON.stringify(model)
    

    The values can then be passed into your post method. I hope this simplifies the process for someone with a large form.

提交回复
热议问题