API代码可在Angular中使用,但不能在Ionic中使用

时间:2018-11-27 08:42:28

标签: angular api ionic3

我获得了以下API,将应用程序连接到zoho creator

 <form method="POST" action="https://creator.zoho.com/api/batool4/xml/myapp/form/form1/record/add">
<input type="hidden" name ="authtoken" value="14e8d1c6acf83682cd9622986f0f7999">
<input type="hidden" name ="scope" id="scope" value="creatorapi">
<input type="text" name="Phone">
<input type="text" name="Date_field" value="11-Nov-2011">
<input type="text" name="Name_field">    
<input type="submit" value="Add Record">
</form>

我已经在Ionic中尝试了这段代码,但是没有用,但是一旦我在Angular中尝试了它,它就可以正常工作并插入了数据。任何人都可以帮助如何使代码也适用于Ionic。

1 个答案:

答案 0 :(得分:0)

在angular和Ionic中,我们不在表单中使用这种方式,我们使用两种方法使用Reactive Forms或Tempalte Driven Forms从表单中提取数据,然后提供调用此api并将其传递给它的服务。
在这里,您是一个完整的示例,其中包含您想要的表单,只需修复与您的表单相匹配的内容: https://stackblitz.com/edit/angular-forms-solution?file=src%2Fapp%2Fapp.component.ts