Hi Claus, Looking quickly, I don't see any mentions of it either on http://docs.angularjs.org/guide/directive It may be somewhere else on the Angular site, though.
Pawel Kozlowski (one of the contributors to Angular and co-author of "Mastering Web Application Development with AngularJS") explains the difference in another thread in this group: https://groups.google.com/forum/#!topic/angular/7Rnd5RjdlCc "scope:true will create a child scope that will prototypically inherit from its parent, so you will be able to access values defined on parent's scope in your directive. scope:{} will create a child scope as well but this time a prototypical inheritance link will be broken and a directive will be "isolated". We usually use isolated scope in directives when we want to use reusable widgets. By creating an isolated scope we can assure that a directive can't mess up things in other scopes." So it seems like your scope: {} with transcluded content is technically a better solution, since it better encapsulates the directive code. Dave On Sat, Feb 15, 2014 at 9:15 AM, Claus Fjellø-Jensen <[email protected] > wrote: > Hi Sander & Dave, > > I finally got the around to test your hints about "scope: true" and made a > plunker - this concept of 'private scope' (I cannot find any > documentation), > will solve many of my issues, even though transclude still seem to link to > the outer scope: > > http://plnkr.co/edit/vls1XLXjDFdOqDrS8NLL?p=preview > > Thanks again, guys! > > Regards, > Claus > > > > > On Saturday, February 15, 2014 10:39:48 AM UTC+1, Claus Fjellø-Jensen > wrote: >> >> Hi Dave & Sander, >> >> Thanks for your responses, it really helped me to figure out what I need >> to change in my code! >> >> I need the isolated scope, so I updated the plunker to reflect that: >> >> http://plnkr.co/edit/tC8LHvNKKKZAwrh8KwKs?p=preview >> >> When using transclude, the transcluded part (after version 1.0.8) no >> longer refers to the isolated scope of your directive, but to the whatever >> outer scope there is. >> Well, corrected bug or feature? It means, that what is enclosed by your >> isolated directive html tag, even if it includes no new scopes, is not >> controlled by your directive. >> >> Another change I found, that I find somewhat counter intuitive, has to do >> with the compile function within an isolated scope directive - it no longer >> compiles to the isolated scope: >> >> http://plnkr.co/edit/BP2CRxI33LERYQf77jw5?p=preview >> >> I understand, that one can easily argue, that compile does not know the >> directive scope, but you wouldn't get many point for usability and API >> functional consistency. >> >> On a personal note concerning isolated scope, I would like to see that >> multiple isolated scopes could be created from a common master scope (e.g. >> using some scope: {} + 'parentScopeName' notation) and that these isolated >> scopes encapsulated any (transcluded) sub-scopes. That is the natural way >> to handle any master-detail data model where you are mostly concerned with >> isolating the detail-siblings from each other. Explicitly naming the parent >> scope would also allow a structure where you are not always constrained by >> the placement of the controllers within the html. >> >> Regards, >> Claus >> >> >> On Saturday, February 15, 2014 8:01:54 AM UTC+1, Sander Elias wrote: >>> >>> Hi Claus, >>> >>> Actually you made use of a bug prior to 1.2.0 (see >>> changelog<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fangular%2Fangular.js%2Fblob%2Fmaster%2FCHANGELOG.md%23120-timely-delivery-2013-11-08&sa=D&sntz=1&usg=AFQjCNGUsvVJnXAuWrl0-CjGx8IQwk-50w> >>> ). >>> An isolated scope was never meant to be visible to all it's childs. If >>> you need that, >>> you need an private scope (scope : true) in stead on an isolate one. >>> >>> Regards >>> Sander >>> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/7yrdaUzsOZE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
