I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[X ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Currently the methods AbstractControl#getError and AbstractControl#hasError accept a 2nd. parameter that let you specify the path of the control. Ex:
formGroup.hasError('errorCode', ANYPATH);
However, both of these methods have the following signature:
getError(errorCode: string, path?: string[]): any
hasError(errorCode: string, path?: string[]): boolean
... and behind the scenes these methods just call the AbstractControl#get method, which one accepts a string or an array of number | string.
Doesn't it make sense to change the signatures to the same of get method?
getError(errorCode: string, path?: string | (number | string)[]): any
hasError(errorCode: string, path?: string | (number | string)[]): boolean
So, we can just call this method as usual in get.
Expected behavior
Instead of formGroup.hasError('required', ['x', 'y', 'z']) we can have formGroup.hasError('required', 'x.y.z') for example (as we can call in get method).
What is the motivation / use case for changing the behavior?
More flexibility.
I'm submitting a...
Current behavior
Currently the methods AbstractControl#getError and AbstractControl#hasError accept a 2nd. parameter that let you specify the path of the control. Ex:
formGroup.hasError('errorCode', ANYPATH);However, both of these methods have the following signature:
... and behind the scenes these methods just call the AbstractControl#get method, which one accepts a
stringor anarrayofnumber | string.Doesn't it make sense to change the signatures to the same of
getmethod?So, we can just call this method as usual in
get.Expected behavior
Instead of
formGroup.hasError('required', ['x', 'y', 'z'])we can haveformGroup.hasError('required', 'x.y.z')for example (as we can call ingetmethod).What is the motivation / use case for changing the behavior?
More flexibility.