Skip to content

Instantly share code, notes, and snippets.

@paritosh64ce
Last active November 12, 2017 14:11
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 paritosh64ce/d6feeb8050b03b064b00fe8d62703450 to your computer and use it in GitHub Desktop.
Save paritosh64ce/d6feeb8050b03b064b00fe8d62703450 to your computer and use it in GitHub Desktop.
Example - calling Angular1.x service from controller with/without headers
// controller function – calling service
$scope.loadOrders = function() {
orderService.loadOrder()
.then(function(result){
if(result) {
//populate $scope property for the view
}
})
}
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