ion-searchbar "value" attribute not working anymore
See original GitHub issueIonic version: (check one with “x”) [ X] 3.1.0
I’m submitting a … (check one with “x”) [X ] bug report
Current behavior: Just updated to ionic 3.1.0. After using “ionic serve” the “default” value of ion-searchbar does not get shown in the input field of ion-searchbar anymore.
Code:
<ion-searchbar color="primary" debounce="150" value="**THIS DEFAULT VALUE IS NOT SHOWN ANYMORE**" (ionInput)="function($event)"></ion-searchbar>
Expected behavior: The Text of value shout be inside the ion-searchbar input field.
Steps to reproduce: Just use the ion-searchbar with the value attribute.
Related code:
<ion-searchbar color="primary" debounce="150" value="**THIS DEFAULT VALUE IS NOT SHOWN ANYMORE**" (ionInput)="function($event)"></ion-searchbar>
insert any relevant code here Other information:
“dependencies”: { “@angular/common”: “4.0.2”, “@angular/compiler”: “4.0.2”, “@angular/compiler-cli”: “4.0.2”, “@angular/core”: “4.0.2”, “@angular/forms”: “4.0.2”, “@angular/http”: “4.0.2”, “@angular/platform-browser”: “4.0.2”, “@angular/platform-browser-dynamic”: “4.0.2”, “@ionic-native/core”: “3.4.2”, “@ionic-native/geolocation”: “^3.4.4”, “@ionic-native/keyboard”: “^3.5.0”, “@ionic-native/screen-orientation”: “^3.5.0”, “@ionic-native/splash-screen”: “3.4.2”, “@ionic-native/status-bar”: “3.4.2”, “@ionic/storage”: “2.0.1”, “@types/googlemaps”: “^3.26.8”, “ionic-angular”: “3.1.0”, “ionicons”: “3.0.0”, “rxjs”: “5.1.1”, “sw-toolbox”: “3.4.0”, “zone.js”: “^0.8.5” }, “devDependencies”: { “@ionic/app-scripts”: “1.3.4”, “typescript”: “~2.2.1” },
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
Your system information:
Cordova CLI: 6.5.0 Ionic Framework Version: 3.1.0 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.3.4 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.9.3 Xcode version: Not installed
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Hello all! After some further snooping on this issue I figured out that this is not actually an issue, but is simply how angular data binding works. If you use
ngModel
on an input in angular it will always overwrite thevalue
attribute. If you want to set a default value you can set the value thengModel
is bound to that default value.Hello, thanks for using Ionic! I can confirm that this is a legit issue. We will look into this.