diff --git a/src/components/input/input.html b/src/components/input/input.html
index e76d6f8f15e..04262c41994 100644
--- a/src/components/input/input.html
+++ b/src/components/input/input.html
@@ -27,6 +27,7 @@
[attr.step]="step"
[attr.tabindex]="tabIndex"
[type]="type"
+ [attr.name]="name"
(focus)="handleFocus($event)"
(blur)="handleBlur($event)"
[(ngModel)]="value"
diff --git a/src/components/input/input.spec.ts b/src/components/input/input.spec.ts
index 0b29ba0e72e..3b7aeb16733 100644
--- a/src/components/input/input.spec.ts
+++ b/src/components/input/input.spec.ts
@@ -645,6 +645,16 @@ export function main() {
})();
});
});
+
+ it('supports a name attribute', () => {
+ return builder.createAsync(MdInputWithNameTestController).then(fixture => {
+ const inputElement: HTMLInputElement = fixture.debugElement.query(By.css('input'))
+ .nativeElement;
+ fixture.detectChanges();
+
+ expect(inputElement.name).toBe('some-name');
+ });
+ });
});
}
@@ -814,3 +824,12 @@ class MdInputWithBlurAndFocusEvents {
directives: [MdInput]
})
class MdInputOptionalAttributeController {}
+
+@Component({
+ selector: 'test-input-controller',
+ template: `
+
+ `,
+ directives: [MdInput]
+})
+class MdInputWithNameTestController {}
diff --git a/src/components/input/input.ts b/src/components/input/input.ts
index a4507558e38..01a00b9f39e 100644
--- a/src/components/input/input.ts
+++ b/src/components/input/input.ts
@@ -155,6 +155,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
@Input() step: number;
@Input() tabIndex: number;
@Input() type: string = 'text';
+ @Input() name: string = null;
private _blurEmitter: EventEmitter = new EventEmitter();
private _focusEmitter: EventEmitter = new EventEmitter();