您正在发出格式错误的$ http请求。
您不应在单独调用中设置标头
$http。Call to
$http()实际上会发出请求,但是由于您仅使用标头配置了请求(没有url或方法),因此它会向您抛出该错误(如预期的那样)。
如果要设置标题,则需要通过将自定义配置对象作为第二个参数传递给
$http.get()调用来实现:
$http.get(url, { headers: { 'Content-type': 'application/json' }}).success(function (events) { $scope.events = events;});


