How to set ion-searchbar placeholder dynamically

I would like to have a generic search bar component but can’t figure out how to set the placeholder through binding or interpolation. Is this possible and if so how?

Found this -

Doesnt seem to work.

placeholder={{myVar}}
[placeholder]="myVar"

Also no luck.

I might have missed something simple but Ive looked around and cant figure it out.

Ionic:

   ionic (Ionic CLI)             : 4.10.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.4.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 4 other plugins)

System:

   NodeJS : v10.15.1 (/usr/local/bin/node)
   npm    : 6.8.0
   OS     : macOS Mojave
   Xcode  : Xcode 10.1 Build version 10B61

Just needed to put a function in apparently

[placeholder]="getMyPlaceholder()"
1 Like