BRIEF:
My controller property is NOT available to my directive, but it is 
available to the directive's child content... Not sure I understand why. 
(there's more things I'm trying to do, but see the longer CONTEXT below for 
that)

Here's a plunkr: http://plnkr.co/edit/jMkHUPtYACTMNepJFMDi?p=preview
A rough tree view of the page, to help illustrate my confusion:
(you'll see MainCtrl controller declares a vm.name = "Fred")

body (MainCtrl as vm)
 + vm.name (Fred) <------------------------------ OK
 + my-directive (without child contents)
    + vm.name (blank) <-------------------------- UH?
 + my-directive (with child contents)
    + vm.name (blank) <-------------------------- UH?
    + ng-transclude
       + vm.name (Fred) <------------------------ OK, BUT WHY?

my-directive is currently set with transclude:true, AND scope: {...}

CONTEXT:
What am I trying to do anyway?
Well, the plunkr above is not the whole thing, but I'm trying to put 
together a directive that I can use to wrap around other 'stuff'. Think of 
it as a "panel" container widget (or like the angular-material cards 
<https://material.angularjs.org/latest/demo/card>)

Eventually, I'd like to be able to:

   1. Optionally specify attribute arguments (eg: <my-panel title="My 
   Title" />)
   2. Optionally specify a reference to a separate resource (file) for the 
   contents (eg: <my-panel contents="some/path/to/contents.html" />)
   3. Optionally specify content as children elements (eg: <my-panel><p>My 
   Content</p></my-panel>)
   4. Allow combinations of 1, 2, and 3
   5. Display and edit data in the child content (whether it comes from a 
   separate html template or children nodes), with the model being in the 
   Controller of the page/state (so a Controller outside of the panel widget, 
   or of its contents)

Some of this may be impossible, or some combinations may be impossible 
(e.g.: I haven't seen an example of 2 and 3 together, or 1 and 5), but I 
haven't seen any explicit warning in this regard, so I wonder and try, and 
... well, maybe you'll help me understand.
Thanks in advance!

-- 
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/d/optout.

Reply via email to