diff --git a/src/components/input/input.html b/src/components/input/input.html
index 5f0f79086fbf..a255b5688515 100644
--- a/src/components/input/input.html
+++ b/src/components/input/input.html
@@ -13,6 +13,8 @@
[attr.aria-required]="ariaRequired"
[attr.aria-invalid]="ariaInvalid"
[id]="inputId"
+ [attr.min]="min"
+ [attr.max]="max"
[disabled]="disabled"
[required]="required"
[spellcheck]="spellcheck"
diff --git a/src/components/input/input.spec.ts b/src/components/input/input.spec.ts
index 11246dd183c9..1004be3a78fb 100644
--- a/src/components/input/input.spec.ts
+++ b/src/components/input/input.spec.ts
@@ -282,6 +282,22 @@ export function main() {
expect(testComponent.onBlur).toHaveBeenCalledWith(fakeEvent);
})();
});
+
+ it('supports min and max attributes for number fields', () => {
+ return builder
+ .overrideTemplate(MdInputNumberTypeConservedTestComponent, `
+
+
+ `)
+ .createAsync(MdInputNumberTypeConservedTestComponent)
+ .then(fixture => {
+ const inputElement: HTMLInputElement = fixture.debugElement.query(By.css('input'))
+ .nativeElement;
+
+ fixture.detectChanges();
+ expect(inputElement.getAttribute('min')).toBe('0');
+ expect(inputElement.getAttribute('max')).toBe('10');
+ });
});
});
}
diff --git a/src/components/input/input.ts b/src/components/input/input.ts
index 33de725e0b65..cb0785e4c06d 100644
--- a/src/components/input/input.ts
+++ b/src/components/input/input.ts
@@ -144,6 +144,8 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
@Input() @BooleanFieldValue() required: boolean = false;
@Input() @BooleanFieldValue() spellcheck: boolean = false;
@Input() type: string = 'text';
+ @Input() max: number = null;
+ @Input() min: number = null;
private _blurEmitter: EventEmitter = new EventEmitter();
private _focusEmitter: EventEmitter = new EventEmitter();