Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http promises resolving changed in 1.1.4 #2371

Closed
@ilplotkin

Description

@ilplotkin

The following code works successfully in 1.1.3 (and earlier) but does not work in 1.1.4. It does work in 1.1.4 if you replace setTimeout with $timeout or wrap $http.get() into $scope.apply(). Otherwise promise is not resolved until nearest digest cycle. Yes, in general, $q promises resolving is propagated to the nearest digest cycle. But the code below does work in 1.1.3 and docs state that $http callbacks should automatically be wrapped into $apply().

So the question is: where is the correct behavior, 1.1.3 or 1.1.4?
Is it bug introduced in 1.1.4 of bugfix and now the behavior is correct?

function MyCtrl($scope, $http, $timeout) {
   setTimeout(function(){
       $http.get('/echo/json', {data: 'TEST'}).then(function(res){
          $scope.test = res.config.data;
       });
   });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions