Apologies not sure what happened there. I have fixed the plunker. Unfortunately as well as adding new elements, I also need to amend some existing ones (add ng-class attributes) so I would need to compile quite a few of them anyway. I was also influenced by this post which suggests that I would need to compile the form again anyway for the validation to work:
http://stackoverflow.com/questions/18927469/how-to-add-validation-attributes-in-an-angularjs-directive On Thursday, 2 January 2014 03:36:35 UTC, Daniel Tabuenca wrote: > > I was able to see some of the previous code in the plunker history. I > don’t know if it will solve your problem or not, but it’s probably better > to compile the label and then attach it to the dom when you call its link > function. Something like: > > var label= angular.element('<label ng-show="formName.dir.$error.required" > class="form-control-static validation-msg" for="dir">field required</label>'); > $compile(label)(scope, function(dom){ > element.append(dom); > }); > > This avoids recompiling everything. > > > -- 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.
