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