angular-validator icon indicating copy to clipboard operation
angular-validator copied to clipboard

I want to dynamic error message and can we show any message on success as well

Open anmolsharma25 opened this issue 11 years ago • 6 comments

.config

$validatorProvider.register = (name, object={}) -> ### Register the rule. @params name: The rule name. @params object: invoke: 'watch' or 'blur' or undefined(validate by yourself) init: function(scope, element, attrs, $injector) validator: RegExp() or function(value, scope, element, attrs, $injector) error: string or function(value, scope, element, attrs, $injector) success: function(value, scope, element, attrs, $injector) ###

.run

$validator.register = (name, object={}) ->

I want to dynamic error message and can we show any message on success as well

anmolsharma25 avatar Nov 04 '14 03:11 anmolsharma25

yes you can, use $attr

hueitan avatar Nov 04 '14 03:11 hueitan

i have to use function in error and succuss method using $attr

$attr = "my message"; return $attr will show message ??

anmolsharma25 avatar Nov 04 '14 03:11 anmolsharma25

what is $attr ??

anmolsharma25 avatar Nov 04 '14 15:11 anmolsharma25

check https://docs.angularjs.org/api/ng/type/$compile.directive.Attributes

$attr A map of DOM element attribute names to the normalized name. This is needed to do reverse lookup from normalized name back to actual name.

On Tue, Nov 4, 2014 at 12:34 PM, Anmol Sharma [email protected] wrote:

what is $attr ??

— Reply to this email directly or view it on GitHub https://github.com/kelp404/angular-validator/issues/36#issuecomment-61657594 .

genuinefafa avatar Nov 04 '14 15:11 genuinefafa

Actually I am new angularjs . Can any one help to add dynamic error message

anmolsharma25 avatar Nov 04 '14 17:11 anmolsharma25

I am bit confused $attr

anmolsharma25 avatar Nov 04 '14 17:11 anmolsharma25