Ole Ole - 10 months ago 45
Javascript Question

What does the expression {headers : headers} evaluate to?

I'm reading through a tut-spring-security-and-angular-js Tutorial and it contains the following expression line:

$http.get('user', {headers : headers}).then(function(response)

What does the
{headers : headers}
expression evaluate to?



It's an object literal with one propetry headers equal to whateever is stored under variable named headers.

A little easier to understand example:

var someValue = "aaa";
var myObject = {
  someKey: someValue 

var headers = "abcdef";
var secondParameter = {
  headers: headers

$.get("...", secondParameter);