Hi Kenese

I think it's a way better idea to create your own validator and attach that 
to the ngModelController. this is way more efficient then
recompiling parts of your app. In my opinion, compiling is a last resort. 
If you really can't use any of the things that are 
available already, then compiling in your own stuff is an option.
Why?, you may ask. Well, compiling is a complex and expensive(read SLOW) 
operation. In most cases, there is a much
simpler/faster option available.

So, here is an example on how to add a custom 
validator: http://plnkr.co/edit/dQBuJ5B50C6SpKgJNlAt?p=preview

Oh, BTW, Your solution did not work, for a number of reasons. 
  1. wrong prioreties.
  2. ng-if introducing a new scope
  3. because of the 2 points above, the input was connected to the wrong 
scope

Compiling is complex. So is the way forms and inputs and ngModel are 
constructed in Angular 1.x 
Don't mix and match those 2. It is possible, but not easy.

Regards
Sander

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

Reply via email to