如何在AngularJS中的移动设备(WebService)发送的控制器中获取表单数据 [英] How to get form data in controller which is sent by mobile (webservice) in angularjs
问题描述
我正在研究一个移动应用程序项目,并且正在用angularjs创建Web服务.我的问题是如何在控制器中获取通过移动应用程序发送的表单数据.如果我们有html表单,则有一个要在控制器中调用的操作,但是在这里,我试图通过angularjs中的Web服务(移动设备)获取表单数据.
我不知道如何发布此问题,因此,如果有问题,请给我建议.
混乱太多了.
修改 简单的解释
<form name="userForm" action="signup/" role="form">
<input type="text" ng-model="obj.vFirst">
<input type="text" ng-model="obj.vLast">
<input type="text" ng-model="obj.vEmail">
<input type="text" ng-model="obj.vPassword">
<input type="radio" ng-model="obj.eGender" name="eGender" value="Male">
<input type="radio" ng-model="obj.eGender" name="eGender" value="Female">
<input type="file" nv-file-select="" uploader="uploader" accept="image/*" id="image-upload-input" name="vImage" >
</form>
如何在具有动作属性的控制器中获取表单数据
app.controller('signupCtrl', ['$scope', 'Data', '$http', 'FileUploader','$location', function ($scope, Data, $http, FileUploader,$location) {
/* How do I get Form data here ? */
}
或者您可以使用邮递员休息客户端将数据发布到控制器
我认为您正在以错误的方式解决问题.据我了解,您希望从移动应用程序发送一些信息.在这种情况下,您将需要一个服务器端Web服务,该服务将处理您的数据,而不是通过Web套接字或smth将数据发布到Web应用程序上的AngularJS控制器.
对于Web套接字,您可以在PHP中使用 http://socketo.me/
您无法在AngularJS中编写Web服务,Web服务是服务器端应用程序,可能具有REST API或处理来自其他客户端(如移动应用程序和Web应用程序)的请求. >
I am working on a mobile application project and I am creating webservices in angularjs. My question is how to get form data in controller which are sent through Mobile Application. There is a action to call in controller if we have html form but here I am trying to fetch form data through webservice (mobile) in angularjs.
I don't know how to post this question, so please give me suggestion for this question if it is wrong.
There is so much confusion.
Edit Simple explanation
<form name="userForm" action="signup/" role="form">
<input type="text" ng-model="obj.vFirst">
<input type="text" ng-model="obj.vLast">
<input type="text" ng-model="obj.vEmail">
<input type="text" ng-model="obj.vPassword">
<input type="radio" ng-model="obj.eGender" name="eGender" value="Male">
<input type="radio" ng-model="obj.eGender" name="eGender" value="Female">
<input type="file" nv-file-select="" uploader="uploader" accept="image/*" id="image-upload-input" name="vImage" >
</form>
How do I get form data in controller with action attribute
app.controller('signupCtrl', ['$scope', 'Data', '$http', 'FileUploader','$location', function ($scope, Data, $http, FileUploader,$location) {
/* How do I get Form data here ? */
}
or you can use postman rest client to post data to the controller
I think you are approaching the problem the wrong way. As I understand, you wish to send some information from the mobile app. In this case you will need a server side web service which will handle your from data and than publish that data via a web socket or smth to your AngularJS controller on your web app.
For web sockets you can use http://socketo.me/ in PHP
You cannot write a web service in AngularJS, a web service is a server side application which has maybe a REST API or handles request that comes from other clients like mobile apps and web apps.
这篇关于如何在AngularJS中的移动设备(WebService)发送的控制器中获取表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!