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

docs(tutorial) Change ctrls to not have name twice in tutorial #4415

Closed

Conversation

victorb
Copy link
Contributor

@victorb victorb commented Oct 14, 2013

Naming both the controller and the function passed in to it with the
controller name both seems unessecery and confusing to beginners. This
commit removes the name from the function, as it is in the rest of the
docs.

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@victorb
Copy link
Contributor Author

victorb commented Oct 14, 2013

Signed CLA with: Victor Bjelkholm
commit message follows the guidelines.

@btford
Copy link
Contributor

btford commented Oct 14, 2013

commit message follows the guidelines.

you're missing a colon (:). should be docs(tutorial): change controllers to not have name twice

Naming both the controller and the function passed in to it with the
controller name both seems unessecery and confusing to beginners. This
commit removes the name from the function, as it is in the rest of the
docs.
@victorb
Copy link
Contributor Author

victorb commented Oct 14, 2013

you're missing a colon (:). should be docs(tutorial): change controllers to not have name twice

Sorry about that, fixed now!

@btford
Copy link
Contributor

btford commented Oct 14, 2013

No problem. Thanks for correcting it. :)

@petebacondarwin
Copy link
Contributor

The benefit of naming these functions come out when you are debugging, since you then get nice names for the function in the call stack rather than anonymous.

This is good practice in my opinion - minification can remove them if you are worried about file size.

Perhaps, instead, there should be a line in the tutorial explaining why these are here?

@petebacondarwin
Copy link
Contributor

Closing due to lack of activity

@victorb
Copy link
Contributor Author

victorb commented Nov 13, 2013

I'm not worried about the size of the code, I'm worry about repeating myself in my code. Also, this practice is not used anywhere else so I thought that no one is using this.

Of course it's nice with the name of the function in the call stack but it is really necessary?

Either way, there should be a decision about either using it with the name twice everywhere or nowhere except a section with debugging tips or something similar.

(Missed that there was any reply to this so please open it up again if you can)

@petebacondarwin
Copy link
Contributor

OK, so since we don't seem to do this anywhere else, it is probably best to be consistent. I'm going to merge your changes.

@petebacondarwin
Copy link
Contributor

Now to update the phonecat project itself, accordingly ...

@petebacondarwin
Copy link
Contributor

Done

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
While giving the controller function a name helps with debugging,
since otherwise your controller will be anonymous in stack traces,
passing the name to both the `controller()` method and as the function name
is confusing for beginners.

Closes angular#4415
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
While giving the controller function a name helps with debugging,
since otherwise your controller will be anonymous in stack traces,
passing the name to both the `controller()` method and as the function name
is confusing for beginners.

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

Successfully merging this pull request may close these issues.

4 participants