How to get form data in controller which is sent by mobile (webservice) in angularjs

流过昼夜 提交于 2020-01-06 07:43:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!