Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit a4b8c81

Browse files
committed
chore(NgModel): Use if statements instead of trinaries
1 parent b30ebe0 commit a4b8c81

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib/directive/ng_model.dart

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,11 @@ class NgModel extends NgControl implements NgAttachAware {
181181
_modelValue = value;
182182
setter(value);
183183

184-
modelValue == _originalValue
185-
? markAsPristine()
186-
: markAsDirty();
184+
if (modelValue == _originalValue) {
185+
markAsPristine();
186+
} else {
187+
markAsDirty();
188+
}
187189
}
188190

189191
List<NgValidator> get validators => _validators;
@@ -195,15 +197,19 @@ class NgModel extends NgControl implements NgAttachAware {
195197
_toBeValidated = false;
196198
if (validators.isNotEmpty) {
197199
validators.forEach((validator) {
198-
validator.isValid(modelValue) == false
199-
? this.addError(validator.name)
200-
: this.removeError(validator.name);
200+
if (validator.isValid(modelValue)) {
201+
removeError(validator.name);
202+
} else {
203+
addError(validator.name);
204+
}
201205
});
202206
}
203207

204-
invalid
205-
? addInfo(NgControl.NG_INVALID)
206-
: removeInfo(NgControl.NG_INVALID);
208+
if (invalid) {
209+
addInfo(NgControl.NG_INVALID);
210+
} else {
211+
removeInfo(NgControl.NG_INVALID);
212+
}
207213
}
208214

209215
/**

0 commit comments

Comments
 (0)