J. Doe J. Doe - 1 year ago 57
PHP Question

Get values and pass to api ionic angularJS

I have a form:

<form name="loginform" novalidate class="css-form">
<label class="item item-input item-stacked-label">
<span class="input-label">Email</span>
<input type="email" name="email" ng-model="user.username" placeholder="Email" required>
<p class="error validationerror"
ng-show="loginform.email.$invalid && loginform.email.$touched">
Must be a valid email</p>
<label class="item item-input item-stacked-label">
<span class="input-label">Password</span>
<input type="password" name="password" ng-model="user.password" placeholder="Password" required>
<p class="error validationerror"
ng-show="loginform.password.$invalid && loginform.email.$touched">
Password is required</p>

<input type="submit" ng-click="Login(user)" class="button button-dark marginauto loginformbtn" value="Login">

and what I want to do is this I want to grab the user.username and the user.password and I want to pass them to a api I know how to grab them but I do not know how to send them as POST to the URL like with cURL in PHP.

here is the angular js code I have:

$scope.Login = function(user) {
$scope.value = {};

Please help thank you

Answer Source

To do $http.post method in angularjs

in your problem

$scope.login= function(user){

     var value = {

      $http.post("place your http service here",value)

To know more about $http look in the official document

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download