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

Added invokeApply parameter to $http to skip apply #12556

Closed
wants to merge 2 commits into from
Closed

Added invokeApply parameter to $http to skip apply #12556

wants to merge 2 commits into from

Conversation

Utsav2
Copy link
Contributor

@Utsav2 Utsav2 commented Aug 12, 2015

There are a bunch of times when we don't want a $rootScope.$apply after an http request succeeds. This stackoverflow question gives a good use case: polling.
We can also use this to do scope specific digests, which really helps performance and snappiness on mobile devices.

It also gives us a little more control over the API, and also makes it similar to $timeout.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@Utsav2
Copy link
Contributor Author

Utsav2 commented Aug 12, 2015

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@Utsav2 Utsav2 closed this Aug 12, 2015
@Utsav2 Utsav2 reopened this Aug 12, 2015
if (!$rootScope.$$phase) $rootScope.$apply();
var skipApply = (isDefined(invokeApply) && !invokeApply);

if (!skipApply) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if skipApply is true, then resolveHttpPromise will not get called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a mistake.

@Utsav2 Utsav2 closed this Aug 12, 2015
@Utsav2
Copy link
Contributor Author

Utsav2 commented Aug 12, 2015

Could you have a look at this #12557? I've fixed the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants