angular-ui/ui-utils

Validation pass-through

ZIJ opened this issue · 2 comments

ZIJ commented

Hi,

I'm trying to use ui-validate in a custom directive, but validation logic is external to it. Is there a way to pass the expression through attributes so that it would be evaluated in parent scope? I tried the following approach, but the expression seems to be evaluated only once:

Using like this:

<div my-directive my-validation="{ myRule : 'myController.myValidator(item)' }"></div>

In directive code:

scope: {
    myValidation: '='
}

And in directive template:

<input ng-model="myModel.name" ui-validate="myValidation"/>

I have the exact same question and would be interested in a possible answer

UI.Utils modules was split in individuals repositories. If still valid, please consider re-submitting the issue on its dedicated issue tracker.

See the README for details.