mdInput: placeholder shows "undefined" if it is a bound value
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?
It's difficult to diagnose without a reproduction of the issue. Here is a plunker that works (doesn't show "undefined" as the placeholder):
http://plnkr.co/edit/4oA07xeCwao3JtBWjhOO?p=preview
Do you think you could try to reproduce it based off that?
I just tested this with ng4 and material beta 2 and I get your expected behaviour - if the bound property is undefined the placeholder is not rendered.
seems to be working, if this is still an issue please provide a plunker to reproduce
Empty value of placeholder helped me.
placeholder=""
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.