Skip to content
This repository was archived by the owner on Aug 15, 2021. It is now read-only.
This repository was archived by the owner on Aug 15, 2021. It is now read-only.

request/potential bug: allow validation when on $touched instead of on $dirty #172

@crhistianramirez

Description

@crhistianramirez

currently only validates when input is $dirty (after user types something in and leaves input)

Would be nice if it would validate when a user touched a required input, left it blank, and moved to another input

I tried creating a custom directive to set any $touched input to $dirty but there seems to be a bug where it only succeeds if that is set in the first ~2 seconds. Not sure if this is a bug with angular or this library.

My simple directive:

    return {
        restrict: 'A',
        require: 'ngModel',
        link: function(scope, elem, attrs, form){
            scope.$watch(function(){
                return form.$touched;
            }, function(wasTouched, oldVal){
                if(wasTouched){
                    form.$setDirty();
                }
            });
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions