Last active
November 12, 2017 14:11
-
-
Save paritosh64ce/d6feeb8050b03b064b00fe8d62703450 to your computer and use it in GitHub Desktop.
Example - calling Angular1.x service from controller with/without headers
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
// controller function – calling service | |
$scope.loadOrders = function() { | |
orderService.loadOrder() | |
.then(function(result){ | |
if(result) { | |
//populate $scope property for the view | |
} | |
}) | |
} |
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
svc.loadOrders = function() { | |
return $http.get('<loadOrderURL>'); // this resturns a promise | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment