Thanks for the reply.

I can't work in the compile function as I need to use the scope to get 
details from the bound model as to what validation is required.  In the end 
I went the route of your original suggestion which was to compile the 
individual elements rather than a blank compile of the whole form.  That 
stack overflow post which I mentioned previously which suggested that you 
needed to recompile the form doesn't seem to hold true after all.  In my 
first attempt it seemed to be the case but I have managed to get it working 
since.

Would still be nice to know the reason for my plunker not working as I 
would expect, however I have an alternative which I can go with for now.

On Thursday, 2 January 2014 18:05:35 UTC, Daniel Tabuenca wrote:
>
> In general, you should not call $compile twice on the same piece of dom. 
> If you are adding directives in the children of your directive you are fine 
> just adding the dom from the compile (since the children have not been 
> compiled yet:
>
> directive('validateForm', function ($compile) {
>     return {
>         restrict: 'A',
>         compile: function (element, attrs) {
>            var form = element.find('form');
>            form.append('<label ng-show="formName.total.$error.noteven" 
> for="total">The total field should not be even.</label>');
>         }
>     };
> });
>
> If you need to add additional directives to the same element of your 
> directive, then you should set terminal: true and give it a high 
> priority. This will stop compilation at your directive, which can then 
> modify the dom and call compile again with a maximum priority (so that your 
> directive does not get called again).
>
>  

-- 
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.

Reply via email to