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

docs(ngController): Add in more description of controller as #7604

Closed
wants to merge 1 commit into from

Conversation

RichardLitt
Copy link
Contributor

Using controller as in the template is not described well
in the docs, as both scope injection and this are presented
equally without too much discussion of the advantages of using
either. I added a bit more discussion based on google's internal
style guidelines.

Should implement changes suggested in #7591. Let me know if you
need a separate PR.

Using `controller as` in the template is not described well
in the docs, as both `scope` injection and `this` are presented
equally without too much discussion of the advantages of using
either. I added a bit more discussion based on google's internal
style guidelines.

Should close angular#5076 until Angular 2.0 comes out and we refactor
everything.
@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7604)

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!

@RichardLitt
Copy link
Contributor Author

@petebacondarwin added $scope instead of scope.

* to the controller and avoiding scope. Using `controller as` makes it obvious which controller
* you are accessing in the template when multiple controllers apply to an element. Since there
* is always a `.` in the bindings, you don't have to worry about prototypal inheritance masking
* primitives.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is good information, but I'm not sure it's presented in a very accessible way --- it feels like it's dumping a whole pile of information onto a (likely new) user who maybe doesn't know what prototype inheritance even is.

Do you think we could make this a bit more accessible? /cc @btford

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Any help would be great.

@petebacondarwin
Copy link
Contributor

Sorry I landed and improved this a while back.
See 2859fc4

@RichardLitt RichardLitt deleted the controller-as branch June 1, 2014 15:57
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.

4 participants