I don't understand how his example is going to utilize the isValid function 
where you are appending the controller to that variable. I'm trying a 
similar thing but instead of jamming an expression directly into the 
ui-validate directive call, I'm having it call a function that checks if 
another field is set as well as the current field, to have it be valid or 
invalid. 

 

* In my template Directive-*
    <select ng-if="novalue" data-ng-model="model" id="{{for}}" 
name="{{for}}" ng-options="option for option in options | 
orderBy:'toString()'" placeholder="{{placeholder}}" class="form-control 
input-sm" ng-change="changed(model)" *ui-validate="{noACM : 
'checkAcm($value)'}"*>
            <option value="">— Select —</option>
    </select>
 
*In my link function on that template directive*

 $scope.checkAcm = function($value){

              if ($scope.model.acm && _.size($($value).text().trim())){
                 return true;
              } else{
                return false;
              }
            }

My current problem is that the checkAcm function never gets called. How in 
my example do I utilize var ctrl = elm.find('input').data('$
ngModelController');

-Chris

On Thursday, February 13, 2014 11:36:47 AM UTC-5, Rafael Dipold wrote:
>
> Hi Sander,
>
> Thanks for the explanation. I see now, and the punkler is a snippet of my 
> code, but I will adapt it to my reality.
>
> Best Regards
>
> Rafael Dipold
> [email protected] <javascript:>
>  
>
>
> On Thu, Feb 13, 2014 at 2:24 PM, Sander Elias <[email protected]<javascript:>
> > wrote:
>
>> Hi Rafael,
>>
>> I know that that would do, however your solution adds an extra ng-model, 
>> that's not used at all. this is just wasting a lot of cpu cycles. Hence the 
>> extra changes I put in.
>>
>> Regards
>> Sander
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/angular/cMgxWTM-j00/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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