-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(tutorial) Change ctrls to not have name twice in tutorial #4415
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Signed CLA with: Victor Bjelkholm |
you're missing a colon ( |
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.
Sorry about that, fixed now! |
No problem. Thanks for correcting it. :) |
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? |
Closing due to lack of activity |
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) |
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. |
Now to update the phonecat project itself, accordingly ... |
Done |
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
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
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.