Skip to content

Instantly share code, notes, and snippets.

@oexenhave
Created May 20, 2013 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oexenhave/5612691 to your computer and use it in GitHub Desktop.
Save oexenhave/5612691 to your computer and use it in GitHub Desktop.
Angular code for fetching tasks
function DashboardCtrl($scope) {
// ¤¤¤ Property definitions ¤¤¤
$scope.tasks = [];
$scope.query = '';
// ¤¤¤ Method definitions ¤¤¤
$scope.getTasks = function () {
// Fetch the list of tasks from the web service
$.getJSON(root + 'Task/Get', {}, function (data) {
$scope.$apply(function (scope) {
// Apply the result to the scope and trigger the filter change
scope.tasks = data.Data;
scope.filterChange();
});
});
};
// ¤¤¤ Initialize ¤¤¤
$scope.getTasks();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment