Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created October 29, 2021 16:28
Show Gist options
  • Save anytizer/b2c55d443105e7152bf9927b74fa2e0e to your computer and use it in GitHub Desktop.
Save anytizer/b2c55d443105e7152bf9927b74fa2e0e to your computer and use it in GitHub Desktop.
AngularJS Invoice JSON ($http example)
<!doctype html>
<html>
<head>
<title>Invoice</title>
<script src="angular.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="w3.css" />
</head>
<body ng-app="ReportsApp" ng-controller="InvoiceController">
<div>
{{invoice}}
</div>
</body>
</html>
var app = angular.module("ReportsApp", []);
app.controller("InvoiceController", ["$scope", "$http",
function ($scope, $http) {
$http({
method : "POST",
url: "invoice.php",
})
.then(function (response) {
$scope.invoice = response.data;
}, function (response) {
$scope.invoice = "Request failed";
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment