Skip to content

mdInput: placeholder shows "undefined" if it is a bound value #3847

@mischkl

Description

@mischkl

Bug, feature request, or proposal:

Bug

What is the expected behavior?

If a placeholder is bound to a property on the containing component, and the property is undefined, no placeholder should be shown.

What is the current behavior?

If a placeholder is bound to a property on the containing component, and the property is undefined, 'undefined' is shown as the placeholder.

What are the steps to reproduce?

(template Plunkr does not work at the moment, therefore simply pasting an example in GitHub)

<md-input-container class="col s3">
    <input mdInput [placeholder]="myPlaceholder" type="text" formControlName="foo"></input>
</md-input-container>
@Component({
     selector: 'my-component',
     templateUrl: 'my.component.html'
})
export class MyComponent {
     myPlaceholder;
}

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

In cases where an input placeholder is bound (for instance in the context of a generalized wrapper around the input), it is useful to be able to have the placeholder be shown or hidden depending on the presence of the bound property.

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

Angular 2.4, Material 2.0.0-beta.2

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentcannot reproduceThe team is unable to reproduce this issue with the information provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions