components icon indicating copy to clipboard operation
components copied to clipboard

md-input dynamic type not being applied

Open starksds opened this issue 9 years ago • 4 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When I wrap an input control and pass the type it should be applied

What is the current behavior?

The type does not get set in the markup so something like date or number does not work as expected

What are the steps to reproduce?

Use the input example and then wrap the example with your own component.

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

What is the use-case or motivation for changing an existing behavior?

Documented features should work

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.4.1 Material 2 beta 1 Chrome

Is there anything else we should know?

here is a code example, the top works, the second doesn't:

Md example:
<md-input-container align="end">
    <input md-input placeholder="Number" type="number">
</md-input-container>

Base Input:
<md-input-container align="{{align}}">
    <input md-input type="{{type}}" placeholder="{{placeholder}}">
</md-input-container>

Implementation:
<my-input [align]="'end'"
    [placeholder]="'Number'"
    [type]="'number'">
</my-input>

starksds avatar Jan 05 '17 02:01 starksds

Actually works if I use [attr.type]="type" instead of type={{type}} but still might be a bug

starksds avatar Jan 05 '17 02:01 starksds

Not really a bug, this is how Angular 2's data binding works. Material doesn't do anything with the input, apart from projecting it inside the input container.

crisbeto avatar Jan 06 '17 20:01 crisbeto

@crisbeto for what it is worth this worked before the introduction of the md-input-container

starksds avatar Jan 07 '17 02:01 starksds

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.