-
-
Save cliffmeyers/8b673b37ae3b71dafb42 to your computer and use it in GitHub Desktop.
Controller to fetch very specific types of donuts.
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 DonutController2($scope, $http) { | |
// called from the partial on button click | |
$scope.fetchDonuts = function() { | |
// construct url based on values bound to form elements | |
var url = '/api/donuts/list?size=' + $scope.size + | |
'&filling=' + $scope.filling + | |
'&glaze=' + $scope.glaze + | |
'&hole=' + $scope.hasHole ? 1 : 0; | |
// feed me | |
$http.get(url) | |
.then(function(response) { | |
$scope.donuts = response.data.results; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment