Ah, got it. I was confusing myself with my func name resumeCompilation, I 
think : )

Fyi. Daniel's version has the added bonus that in the rendered dom, the 
ngModel attr value will be the resolved string, 'fromData.email' in this 
case.
That allows for eg. targeting fields in e2e tests. 
For ex. enter('formData.email').enter('[email protected]')

Thanks again for your help, much appreciated!!


On Thursday, January 9, 2014 4:38:48 PM UTC+1, Daniel Tabuenca wrote:
>
> The actual resume of compile is when you call $compile, not when you link 
> the result. You have to make sure you don’t resume until you added the 
> attribute you want in the link function.
>
> .directive('foo', function($compile) {
>   return {
>     restrict: 'A',
>     priority: 9999,
>     terminal: true,
>     link: function(scope, el, attr) {
>         attr.$set('ngModel', 'formData.' + scope[attr.foo]);
>         // Resume the compilation phase after setting ngModel
>         $compile(el, null, 9999)(scope);
>     }
>   };
> });
>
> 

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