Skip to content

Commit e30083b

Browse files
authored
Merge branch '9.0.x' into mkirova/fix-9.0.x-7234
2 parents e32fca2 + 4ee8f74 commit e30083b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

projects/igniteui-angular/src/lib/directives/input/input.directive.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,18 @@ describe('IgxInput', () => {
494494
expect(igxInput.valid).toBe(IgxInputState.INITIAL);
495495
}));
496496

497+
it('should correctly update enabled/disabled state of igxInput when changed via reactive form', fakeAsync(() => {
498+
const fixture = TestBed.createComponent(ReactiveFormComponent);
499+
fixture.detectChanges();
500+
const igxInput = fixture.componentInstance.strIgxInput;
501+
502+
fixture.componentInstance.form.disable();
503+
expect(igxInput.disabled).toBe(true);
504+
505+
fixture.componentInstance.form.get('str').enable();
506+
expect(igxInput.disabled).toBe(false);
507+
}));
508+
497509
it('should style input when required is toggled dynamically.', () => {
498510
const fixture = TestBed.createComponent(ToggleRequiredWithNgModelInputComponent);
499511
fixture.detectChanges();

projects/igniteui-angular/src/lib/directives/input/input.directive.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export enum IgxInputState {
3939
* @example
4040
* ```html
4141
* <input-group>
42-
* <label for="address">Adress</label>
42+
* <label for="address">Address</label>
4343
* <input igxInput name="address" type="text" [(ngModel)]="customer.address">
4444
* </input-group>
4545
* ```
@@ -289,6 +289,10 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy {
289289
* @internal
290290
*/
291291
protected onStatusChanged() {
292+
// Enable/Disable control based on ngControl #7086
293+
if (this.disabled !== this.ngControl.disabled) {
294+
this.disabled = this.ngControl.disabled;
295+
}
292296
if (this.ngControl.control.validator || this.ngControl.control.asyncValidator) {
293297
if (this.ngControl.control.touched || this.ngControl.control.dirty) {
294298
// TODO: check the logic when control is touched or dirty

0 commit comments

Comments
 (0)