Created
May 20, 2013 14:47
-
-
Save oexenhave/5612691 to your computer and use it in GitHub Desktop.
Angular code for fetching tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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