Skip to content

Commit

Permalink
fix(input): make sure injected NgControl belongs to the input (#3700)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba authored and jelbourn committed Mar 27, 2017
1 parent dc5c869 commit 220163e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/lib/input/input-container.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import {
Component,
Input,
Directive,
AfterContentInit,
Component,
ContentChild,
ContentChildren,
Directive,
ElementRef,
QueryList,
ViewEncapsulation,
EventEmitter,
Input,
Optional,
Output,
EventEmitter,
Renderer
QueryList,
Renderer,
Self,
ViewEncapsulation
} from '@angular/core';
import {coerceBooleanProperty} from '../core';
import {NgControl} from '@angular/forms';
import {getSupportedInputTypes} from '../core/platform/features';
import {
MdInputContainerUnsupportedTypeError,
MdInputContainerPlaceholderConflictError,
MdInputContainerDuplicatedHintError,
MdInputContainerMissingMdInputError
MdInputContainerMissingMdInputError,
MdInputContainerPlaceholderConflictError,
MdInputContainerUnsupportedTypeError
} from './input-container-errors';


Expand Down Expand Up @@ -181,7 +182,7 @@ export class MdInputDirective {

constructor(private _elementRef: ElementRef,
private _renderer: Renderer,
@Optional() public _ngControl: NgControl) {
@Optional() @Self() public _ngControl: NgControl) {

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

0 comments on commit 220163e

Please sign in to comment.