问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/29515882/how-to-get-form-data-in-controller-which-is-sent-by-mobile-webservice-in-angul