Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
fix(textfield): Label overlap if value is undefined (#188)
Browse files Browse the repository at this point in the history
Fixes #187
  • Loading branch information
trimox authored Sep 15, 2017
1 parent 0d01b48 commit b2ee5c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Component } from '@angular/core';
templateUrl: './textfield-demo.component.html'
})
export class TextfieldDemoComponent {
username: string = '';
username: string;
prefill:string = 'John Doe';
comments:string;
subject:string;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/textfield/textfield.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ export class MdcTextfieldComponent implements AfterViewInit, OnDestroy, ControlV
}

writeValue(value: string) {
this.value = value;
if (value && value.length > 0) {
this.value = value == null ? '' : value;
if (this.value.length > 0) {
this._mdcAdapter.addClassToLabel('mdc-textfield__label--float-above');
} else {
this._mdcAdapter.removeClassFromLabel('mdc-textfield__label--float-above');
Expand Down

0 comments on commit b2ee5c9

Please sign in to comment.