@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Resource</title>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/angular-resource.min.js"></script>
<script type="text/javascript">
var m1 = angular.module("myApp", ["ngResource"]);
m1.controller("firstController", ["$scope", "$resource", function ($scope, $resource) {
var data = $resource("getData");
//支持的方法
/*
{
"get":{method:"get"},
"save":{method:"post"},
"query":{method:"get",isArray:true},
"remove":{method:"delete"},
"delete":{method:"delete"}
}
*/
$scope.data = data.get({"name": "zhangsan" }, function (data) {//Get请求并传参
});//使用GET请求去请求数据
// console.log(obj);
// var objRe = $resource("", {});
}]);
</script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="firstController">
{{data.name}}
{{data.age}}
</div>
</div>
</body>
</html>