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

docs(angular.forEach): key value reversed in the example code#15384

Closed
TruthReveller wants to merge 1 commit intoangular:masterfrom
TruthReveller:patch-1
Closed

docs(angular.forEach): key value reversed in the example code#15384
TruthReveller wants to merge 1 commit intoangular:masterfrom
TruthReveller:patch-1

Conversation

@TruthReveller
Copy link

@TruthReveller TruthReveller commented Nov 10, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Update error in docs

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change?

Please check if the PR fulfills these requirements

Other information:

 var values = {name: 'misko', gender: 'male'};
 var log = [];
 angular.forEach(values, function(value, key) {
   this.push(key + ': ' + value);
 }, log);
 expect(log).toEqual(['name: misko', 'gender: male']);

should be

angular.forEach(values, function(key, value) {

     var values = {name: 'misko', gender: 'male'};
     var log = [];
     angular.forEach(values, function(value, key) {
       this.push(key + ': ' + value);
     }, log);
     expect(log).toEqual(['name: misko', 'gender: male']);

should be 

angular.forEach(values, function(key, value) {
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, 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.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, 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.

@TruthReveller
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@TruthReveller
Copy link
Author

what happens when Travis CI build fails?

@TruthReveller TruthReveller changed the title docs(angular.forEach): key value reversed for the example docs(angular.forEach): key value reversed in the example code Nov 10, 2016
@Narretz
Copy link
Contributor

Narretz commented Nov 10, 2016

If Travis fails when only documentation is changed, then it's usually not a problem with the PR itself.
However, your change is not correct: the callback fn is called with value, key, same as with regular forEach: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

@Narretz Narretz closed this Nov 10, 2016
@TruthReveller TruthReveller deleted the patch-1 branch November 11, 2016 18:13
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