问题
I am using bootstrap material design for my angular app. Everything works fine except when I change the models associated with inputs (floating label inputs) programmatically after the page has been loaded, the floating labels are not floated.
回答1:
You must fire a change
event when you change the value programmatically.
回答2:
If you are using Angular2 then no custom directive is needed. On the label do something like this.
<label [class.active]="name && name.length > 0">Some Label</label>
来源:https://stackoverflow.com/questions/28688781/bootstrap-material-design-floating-labels-are-not-floated-when-data-is-loaded-d