1. How do I change the underline to bold from dotted when in disabled state?
Use ViewEncapsulation to override default styles with your custom styles. In your component.css
, add the following styles:
.mat-form-field-underline.mat-disabled {
background-image:linear-gradient(to right,rgba(0,0,0,.42) 0,rgba(0,0,0,.42) 100%,transparent 0);
/* Set 4px for a solid line */
background-size : 4px 4px;
}
.. and in your component.ts
file, set encapsulation
to ViewEncapsulation.None
:
import { ViewEncapsulation } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ],
encapsulation: ViewEncapsulation.None
})
2. I know the APIs don't specifically say it but is there any way to to make the floatPlaceholder property work here. (The API only mentions the use of this property for md-select).
Add the floatPlaceholder
attribute on <md-form-field>
instead of <input>
:
<md-form-field floatPlaceholder="never">
<input mdInput placeholder="Name" disabled >
</md-form-field>
Here is a link to complete working demo.