A
A
Alexey Belov2018-12-14 19:55:48
JavaScript
Alexey Belov, 2018-12-14 19:55:48

How to put timeout in AngularJS?

Did you do it right?

function gameData($http) {
    $http.defaults.xsrfHeaderName = 'X-CSRFToken';
    $http.defaults.xsrfCookieName = 'csrftoken';
    $http.defaults.timeout = 6000;
    return {
      get: function (success, error) {
        var options = {
          method: 'GET',
          url: '/game/api/',
          headers: { 'Content-Type': 'application/json; charset=UTF-8' }
        };
        $http(options).then(success).catch(error);
      },

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question