Open johnzakariasabry opened 7 years ago
So you select an item in editable-select and upon save you are expecting the cardExpiration
directive watch to have done something?
the problem is ctrl value
i have 2 pull donwn menu one for year and other for month.. when i change value of month it only set validity for months and when i change the year it set validity for only year
so how to set validity for ctrl that is not clicked notice that i know its name , id and model id
Why can't you call an function in eitheronBeforeSave
or onAfterSave
that will display an error message based upon the value that update and the other input?
i dont know how to call directive in on before save or i will make it into controller?
i want to make it on change
hi dears i made editable-select to call a directive function but it does not work for me
i am using credit card validation in https://gist.github.com/lrvick/8789669 but i want to make it by editable-select but the function is not called at all..
when i made it with normal function it gives alerts when i tried to alert anything but in using watch collection is does not work
<span editable-select="ccinfo.month" e-ng-options="month.text for month in months track by month.value" e-required e-card-expiration e-name="cardExpiryMonth" ng-model="ccinfo.month"> {{ ccinfo.month.value || 'empty' }} </span> <span editable-select="ccinfo.year" e-ng-options="year as year for year in [] | range:currentYear:currentYear+13" e-card-expiration e-required e-name="cardExpiryYear" ng-model="ccinfo.year"> {{ ccinfo.year || 'empty' }} </span>
and the directive function is `'use strict';angular.module('signupApp') .directive('cardExpiration', function () { return { require: 'ngModel', link: function postLink(scope, element, attrs, ctrl) { scope.$watchCollection('[ccinfo.month, ccinfo.year]', function (newValues, oldValues) { ctrl.$setValidity('past', false);
})`