Skip to content

Commit 220163e

Browse files
mmalerbajelbourn
authored andcommitted
fix(input): make sure injected NgControl belongs to the input (#3700)
1 parent dc5c869 commit 220163e

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/lib/input/input-container.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
import {
2-
Component,
3-
Input,
4-
Directive,
52
AfterContentInit,
3+
Component,
64
ContentChild,
75
ContentChildren,
6+
Directive,
87
ElementRef,
9-
QueryList,
10-
ViewEncapsulation,
8+
EventEmitter,
9+
Input,
1110
Optional,
1211
Output,
13-
EventEmitter,
14-
Renderer
12+
QueryList,
13+
Renderer,
14+
Self,
15+
ViewEncapsulation
1516
} from '@angular/core';
1617
import {coerceBooleanProperty} from '../core';
1718
import {NgControl} from '@angular/forms';
1819
import {getSupportedInputTypes} from '../core/platform/features';
1920
import {
20-
MdInputContainerUnsupportedTypeError,
21-
MdInputContainerPlaceholderConflictError,
2221
MdInputContainerDuplicatedHintError,
23-
MdInputContainerMissingMdInputError
22+
MdInputContainerMissingMdInputError,
23+
MdInputContainerPlaceholderConflictError,
24+
MdInputContainerUnsupportedTypeError
2425
} from './input-container-errors';
2526

2627

@@ -181,7 +182,7 @@ export class MdInputDirective {
181182

182183
constructor(private _elementRef: ElementRef,
183184
private _renderer: Renderer,
184-
@Optional() public _ngControl: NgControl) {
185+
@Optional() @Self() public _ngControl: NgControl) {
185186

186187
// Force setter to be called in case id was not specified.
187188
this.id = this.id;

0 commit comments

Comments
 (0)