title: Pass form data to laravel controller using AngularJS
body: <p>I have a simple code here and want to pass data to the laravel controller so I can store it to the database. My codes are:</p>
  
  <p><strong>AccountController.php</strong></p>
  
  <pre><code>public function store(Request $request)
      {
          Account::create(array(
              'email' =&gt; $request-&gt;get('email'),
              'name' =&gt; $request-&gt;get('text'),
              'age' =&gt; $request-&gt;get('age'),
          ));
  
          return ['success' =&gt; true];
      }
  </code></pre>
  
  <p><strong>Blade</strong></p>
  
  <pre><code>&lt;form ng-submit="newAccount()"&gt;
            &lt;div class="form-group"&gt;
              &lt;label for="email"&gt;Email address&lt;/label&gt;
              &lt;input type="email" class="form-control" id="email" ng-model="accountData.email"&gt;
            &lt;/div&gt;
  
            &lt;div class="form-group"&gt;
              &lt;label for="fullname"&gt;Full Name&lt;/label&gt;
              &lt;input type="email" class="form-control" id="fullname" ng-model="accountData.name"&gt;
            &lt;/div&gt;
  
            &lt;div class="form-group"&gt;
              &lt;label for="age"&gt;age&lt;/label&gt;
              &lt;input type="email" class="form-control" id="age" ng-model="accountData.age"&gt;
            &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>var app = angular.module('accountsApp', []);
  
  app.controller('accountsCtrl', function($scope, $http) {
  
   $scope.newAccount = function() {
        //add data
        $http.post('/api/accounts', 
        {
          //what will I put here to get the textbox values?
        }).
        .success(function(response) {
          scope.accounts = response;
        })
        .error(function(response) {
          console.log(response);
        });
  
      };
  
  });
  </code></pre>
  
  <p>As you can see in my <code>app.js</code>, I'm stuck on how to get the data from the textbox in my blade. Is there an easy way to do this? Thank you.</p>