I'm using Spring Data REST and have a MySQL DB to manage my data. With AngularJS I programmed my first page and want to get data from my DB.
To get my data I know about two different ways:
$http.get('http://myURL')
and
$http({
method:'GET'
url:'http://myURL'
}
But where's the difference between them?
Thanks for help!
There is no difference,
$http.get('http://myURL')
is just a shortcut for$http({method:'GET, url:'http://myURL'}
$http.get('url') is just the shorthand notation of writing $http({method:'GET ',url:'url '})
Its same as jQuery is the shorthand notation for JavaScript
If you want to modify header in the api call,use second notation
First way of getting the response is the short form of the second one.
If you want to set some headers for the request you have to write the request via second way... that is much more clear way of writing it.