This repository has been archived by the owner on Feb 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forms): add support for validation handling for multiple error t…
…ypes
- Loading branch information
Showing
6 changed files
with
234 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
part of angular.directive; | ||
|
||
abstract class NgControl { | ||
static const NG_VALID_CLASS = "ng-valid"; | ||
static const NG_INVALID_CLASS = "ng-invalid"; | ||
static const NG_PRISTINE_CLASS = "ng-pristine"; | ||
static const NG_DIRTY_CLASS = "ng-dirty"; | ||
|
||
String _name; | ||
bool _dirty; | ||
bool _pristine; | ||
bool _valid; | ||
bool _invalid; | ||
|
||
get element => null; | ||
|
||
get name => _name; | ||
set name(name) => _name = name; | ||
|
||
get pristine => _pristine; | ||
set pristine(value) { | ||
_pristine = true; | ||
_dirty = false; | ||
|
||
element.classes.remove(NG_DIRTY_CLASS); | ||
element.classes.add(NG_PRISTINE_CLASS); | ||
} | ||
|
||
get dirty => _dirty; | ||
set dirty(value) { | ||
_dirty = true; | ||
_pristine = false; | ||
|
||
element.classes.remove(NG_PRISTINE_CLASS); | ||
element.classes.add(NG_DIRTY_CLASS); | ||
} | ||
|
||
get valid => _valid; | ||
set valid(value) { | ||
_invalid = false; | ||
_valid = true; | ||
|
||
element.classes.remove(NG_INVALID_CLASS); | ||
element.classes.add(NG_VALID_CLASS); | ||
} | ||
|
||
get invalid => _invalid; | ||
set invalid(value) { | ||
_valid = false; | ||
_invalid = true; | ||
|
||
element.classes.remove(NG_VALID_CLASS); | ||
element.classes.add(NG_INVALID_CLASS); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.