Skip to content

ion-input type text not working with undefined initial value in FormGroup formControl #15529

@hebra

Description

@hebra

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.8
   @angular-devkit/core       : 0.8.1
   @angular-devkit/schematics : 0.8.1
   @angular/cli               : 6.2.1
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 14 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/heb/Library/Android/sdk)
   ios-deploy        : 2.0.0
   NodeJS            : v10.10.0 (/usr/local/Cellar/node/10.10.0/bin/node)
   npm               : 6.4.1
   OS                : macOS
   Xcode             : Xcode 10.0 Build version 10L232m```

**Describe the Bug**
When using ion-input type text together with a FormControl where the initial value is empty (or null, undefined) then:
- no placeholder text visible, even though a placeholder attribute is set on the tag
- input itself is not accessible/clickable at all

As soon as at least one value, even just a whitespace is added as initial value everything works fine. Also the placeholder text is displayed properly once the initial whitespace was removed.

**Steps to Reproduce**
Steps to reproduce the behavior:
1. Create a form with an ion-list with an ion-item and an ion-input type text inside
2. in the TS file create a new FormGroup with a form control for that input, set the initial value to undefined (or null)
3. bind the form group to the form and set the formControlName of the input to the key you chose in the FomGroup definition
4. start the app and open it in a browser
5. the input is not accessible
6. Change the initial value to empty string ''
7. reload
8. it is working

**Expected Behavior**
The ion-input should behave the same both for empty string and undefined initial value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions