TheSharpieOne/angular-validation-match

Implementing "Not match"

Closed this issue · 5 comments

What do you think about implementing this feature (the opposite) ?
For instance:

firstname: <input ng-model="user.firstname" type="text" />
lastname: <input ng-model="user.lastname" type="text" match="!user.firstname" />

I know it's not possible with the code today

would you prefer prefixing with ! or having another attribute which can negate the match?

which one of these would be best (all are about the same level of effort)?
prefer with ! <input ng-model="user.lastname" type="text" match="!user.firstname" />
negate 1: <input ng-model="user.lastname" type="text" match="user.firstname" not-match="true" />
negate 2: <input ng-model="user.lastname" type="text" not-match="user.firstname" />

I would have to parse the ! out, but not that hard...

negate 1 (whole other attribute) would allow one to programmatically set the value and thus be able to easily and programmatically change it (could be useful).

negate 2 is really just another directive that applies runs the same logic but does return !value

negate 2 is very simple to implement but it's another directive.
negate 1 is very versatile, it's a very good solution !

Arg... this should probably be documented...

Alright, docs made, version bumped and release created. Should be good!

very quick, thanks !