前台代码:
<html ng-app="App">
<head>
<meta charset="utf-8">
<script src="//apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var formdata = {
"username" :"nihao",
"truename" :"nie"
};
var App = angular.module('App',[]);
App.controller('DemoController', function($scope, $http) {
$scope.count=function() {
$http({
method: "POST",
url: "../user/test",
data:formdata,
headers:{'Content-Type': 'application/x-www-form-urlencoded'},
//设置类型因为是post