Placeholder on ion-searchbar not working


#1

After upgrade to beta8, placeholder attribute from ion-searchbar is not working

    <ion-searchbar>
      [placeholder]="Busca"
    >

The input’s placeholder shown is “Search”, the default value.

 Cordova CLI: 6.1.1
 Gulp version:  CLI version 3.9.1
 Gulp local:   Local version 3.9.1
 Ionic Version: 2.0.0-beta.8
 Ionic CLI Version: 2.0.0-beta.23
 Ionic App Lib Version: 2.0.0-beta.13
 OS: Distributor ID:	LinuxMint Description:	Linux Mint 17.3 Rosa 
 Node Version: v5.7.0

#2

Assuming that you want to assign the string value “Busca” to the placeholder attribute, you’re using a wrong syntax, you should use the following code instead:

<ion-searchbar placeholder="Busca"></ion-searchbar>

With the following syntax <ion-searchbar [placeholder]="Busca"> you’re actually binding the placeholder attribute of the <ion-searchbar> component to a property called Busca (which should be defined in your page in such case).

I would recommend you to check out the Angular 2 Cheatsheet for TypeScript or JavaScript.


#3

Oh, my mistake. Thanks a lot!


#4

<ion-searchbar placeholder="Busca"></ion-searchbar> does work!