Hey guys, This works great for setting the ID into the children. Now I'm stuck trying to figure out how to save the ID into the parent as well. In either of your examples setting a variable on the scope sets it for all instances of the directive.
http://plnkr.co/edit/4hkQLbn34CcPHVgyc2i0?p=preview Is there a way to save the ID into the scope of the parent as well? In other words, to have the "parent is ..." from the plinkr match the children? Chris On Thu, Jul 10, 2014 at 4:21 AM, Roman <[email protected]> wrote: > have you considered using a 'pre' link function in the parent so that you > can populate the scope before the child directives fire? > > http://plnkr.co/edit/iOCoUh1QdVEGklXcFMR8?p=preview > > > On Wednesday, July 9, 2014 4:25:55 PM UTC-4, xrd wrote: >> >> Is there a way to identify the instance of each directive? >> >> I want to build a set of directives where child directives "know" the >> name of their parent directives. I was envisioning knowing the parent ID >> and then $broadcast'ing the ID. Then, inside my child directive, I was >> assuming if I listened for that even using $on, that I could retrieve the >> ID and associate it. Clearly I don't understand the directive lifecycle and >> instantiation. >> >> I built a little plunkr to explain: >> >> http://plnkr.co/edit/QmkzHXeyN1l18LVBgZe8?p=preview >> >> My desired output would be to see the same ID for the first three and >> then another ID for the next three. For example: >> >> foo (parent: 002) >> foo (parent: 002) >> foo (parent: 002) >> foo (parent: 006) >> foo (parent: 006) >> foo (parent: 006) >> >> Any ideas? >> >> Chris >> > -- > 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/LpHjmXkwb6Y/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/d/optout. > -- Chris Dawson 971-533-8335 Human potential, travel and entrepreneurship: http://webiphany.com/ Check out Teddy Hyde, Android editor for GitHub (especially Jekyll blogs): bit.ly/16BL13z -- 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.
