Placeholder dynamic can't be deactivated


Topic: Placeholder dynamic can't be deactivated

THIRIAU pro asked 12 months ago

Hello, I use input like this:

 <div class="md-form md-outline">
    <input mdbInput type="text" class="form-control" id="'specificId" [placeholder]="field.placeholder">
    <label for="'specificId">{{ field.label }}</label>
</div>

When "field.placeholder" is set, it works great, but when it is null, it is marked "null" in the input and label is written in the top of the input. If "field.placeholder" = '' (empty string), placeholder is empty but label is written in the top of the input, not instead of placeholder. The field consider that there is a placeholder. How to deactivate it dynamically when "field.placeholder" is not set or null ?


Arkadiusz Idzikowski staff answered 12 months ago

It looks like this is how Angular handle this case and it's not related to MDB library. Please try to set field.placeholder value to empty string instead.


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: Angular
  • MDB Version: 9.0.1
  • Device: Mac
  • Browser: Safari
  • OS: macOS Catalina
  • Provided sample code: No
  • Provided link: No