ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

ion-searchbar [placeholder] throws error when its more than 1 word

Open codespore opened this issue 10 years ago • 2 comments

ion-searchbar [placeholder] input throws error when string consist of more than 1 word.

Steps to reproduce:

<ion-searchbar [(ngModel)]="searchQuery" [debounce]="500" [placeholder]="Search Question" (input)="search($event)" (cancel)="cancel($event)" (clear)="cancel($event)"></ion-searchbar>

[placeholder]="Search" # => works
[placeholder]="Search Question" # => doesn't work

Here's a screenshot of the error i am getting: developer tools - http localhost 8100 2016-03-15 11-08-22

Running on: Cordova CLI: 6.0.0 Ionic Version: 2.0.0-beta.3 Ionic CLI Version: 2.0.0-beta.19 Ionic App Lib Version: 2.0.0-beta.9 ios-deploy version: 1.8.5 ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v4.3.0 Xcode version: Xcode 7.2.1 Build version 7C1002

codespore avatar Mar 15 '16 15:03 codespore

It is because you are wrapping placeholder in brackets like [placeholder]. Angular is looking at Search Question for an expression. It should be written:

<ion-searchbar placeholder="Search Question">

From the angular docs:

<input [value]="firstName">
Binds property value to the result of expression firstName.

Thanks for the issue!

brandyscarney avatar Mar 15 '16 18:03 brandyscarney

@brandyscarney Thanks for the clarification. I think this should be clearly stated in the docs http://ionicframework.com/docs/v2/api/components/searchbar/Searchbar/

codespore avatar Mar 17 '16 03:03 codespore