I have learned much about recursive directives recently, but there are still a few things I just don't get yet.
This post in particular solved most of my problem: Recursion in Angular directives (Thanks!!)
I have managed to build a recursive rule editor directive based on this technique that does most of what I want. It successfully edits a complex JSON structure that describes a rule for processing messages, allowing you to add and remove levels of hierarchy and edit values.
The directive is designed to be concisely instantiated like this:
<rule-element rule="<scope variable>"></rule-element>
Ideally, I want this directive to behave as part of a form, with signaling for validation, and everything I read is telling me I need to use ngModel for my binding. However, the example, and thus my code, don't use ngModel, opting instead to use attributes and local isolate scopes.
I've read that using ngModel with isolate scopes is tricky (Isolated scope pitfall with ng-model dependency), and my whack-a-mole path to getting here wasn't very successful using ngModel, so I ended up just using bi-directional binding on an attribute.
What's the best way to add the hooks necessary for this element to report to the form it's contained in so I can use angular validation to present messages and enable/disable the submit button?
I'm sure I could hack this somehow, but my main motivation for doing this is to learn the right way, so, uh, here I am.
Here's a plunkr of my work-in-progress directive: http://plnkr.co/edit/02b9zTS1O81wgVapn3eg?p=preview
Any suggestions?