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

ngController allows access to $attrs and $element. Where as ngView doesn't #2289

Closed
jeme opened this issue Apr 3, 2013 · 4 comments
Closed

Comments

@jeme
Copy link

jeme commented Apr 3, 2013

Reading thought the "MVC" Guide, I can see that both of the above directives is mentioned.

http://docs.angularjs.org/guide/dev_guide.mvc

It is discouraged to do DOM manipulation, but the above isn't really in sync as you can do just that from a controller added with ngController.

http://jsfiddle.net/AKXez/79/

Where as it doesn't with ngView

http://jsfiddle.net/d4ruE/120/

Because of the intend, I think it's the ngController that allows for something that we don't necessarily want. Obviously this might not really be something that you wan't to change, but I would like a confirmation on which one is straying from the intent.

/Jens

@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@jeme
Copy link
Author

jeme commented Aug 25, 2013

@btford This was far more a clarification issue regarding how we should proceed things in another framework, where we wanted to address what was intentional of the two as it caused for quite some debate.

@btford btford reopened this Aug 25, 2013
@btford
Copy link
Contributor

btford commented Aug 28, 2013

I assume $attr and $element are there for directive controllers. I couldn't recommend using them outside of that context.

@btford btford closed this as completed Aug 28, 2013
@jeme
Copy link
Author

jeme commented Aug 29, 2013

@btford That is our thought as well... but since <div ng-controller="myController" > </div> breaks that pattern, we wanted a clarification... Especially because we had people using that is an argument for passing in $element and $attr as locals to views.

We presume that that is simply because it potentially saves allot of code by treating the controller passed in with ng-controller just like a directive controller.

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

No branches or pull requests

2 participants