One directive's isolation scope isolates other directives on the same element #1069

Closed
nickretallack opened this Issue Jun 18, 2012 · 3 comments

Comments

Projects
None yet
2 participants

In version 1.0.0, if you give an element a directive with an isolation scope, it will isolate the scope for all directives on that element. For example, notice how my custom directive is preventing ng-model from working:

http://jsfiddle.net/cKdUt/

This is a regression. It worked fine in rc9.

Owner

mhevery commented Jun 18, 2012

This works as expected. The custom directive creates an isolate scope which then prevents the ng-model from seeing anything. since it is isolated. What exactly did you expect to see? If it worked before it was a bug.

mhevery closed this Jun 18, 2012

Well I have at least one other person in this thread who also thought it should work the way I do, as well as someone talking about ugly work-arounds to make it work this way. I think our way should be supported.

https://groups.google.com/forum/?fromgroups#!topic/angular/817HMPB8Czg

I find the currently supported sort of isolation scope to be pretty useless. It would be much more useful if it isolated the directive from the template, rather than isolating part of the template from the rest of the template.

Owner

mhevery commented Aug 16, 2012

its not a question of reconsidering, it is just have .proto works in javascript. Scopes are hierarchical and they prototypically inherit from each other. i.e. if you read you read your object, if no property then parent and so on. but when you write you always write to yourself. Creating anything else would be a huge performance penalty.

As a general rule you should not write to scope. Always write to an object which sits of scope. In other words your expression needs to have at least one '.' in it, and then there are no surprises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment