Skip to content

Instantly share code, notes, and snippets.

@ianmac45
Created October 7, 2014 23:10
Show Gist options
  • Save ianmac45/18b11c891d46bc64c8b8 to your computer and use it in GitHub Desktop.
Save ianmac45/18b11c891d46bc64c8b8 to your computer and use it in GitHub Desktop.
example angular.js controller
var app = angular.module("successes", [])
.controller("DataList", DataListCtrl)
.controller("FiscalYearList", FiscalYearListCtrl);
function DataListCtrl($scope, $http)
{
$http.get('successes.json.php?req=main')
.success(function(data)
{
$scope.entries = data.values;
$("#datatableloading").remove();
})
.error(function(data, status)
{
$("#datatableloading").text("Failed: " + status + "<br />" + data);
});
}
function FiscalYearListCtrl($scope, $http)
{
$http.get('successes.json.php?req=fiscal')
.success(function(data)
{
$scope.entries = data.values;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment