From a0f0004012778eb95dd2bd60650799b59900bb19 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Thu, 25 Feb 2016 18:36:12 -0500 Subject: [PATCH] refactor(searchbar): add class to searchbar when hideCancel is passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit only hide the search icon when hideCancel isn’t passed --- ionic/components/searchbar/searchbar.md.scss | 2 +- ionic/components/searchbar/searchbar.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ionic/components/searchbar/searchbar.md.scss b/ionic/components/searchbar/searchbar.md.scss index acba47956b..4133ddb09f 100644 --- a/ionic/components/searchbar/searchbar.md.scss +++ b/ionic/components/searchbar/searchbar.md.scss @@ -119,7 +119,7 @@ ion-searchbar { // Searchbar Focused // ----------------------------------------- -.searchbar-focused { +.searchbar-focused:not(.searchbar-hide-cancel) { .searchbar-search-icon { display: none; } diff --git a/ionic/components/searchbar/searchbar.ts b/ionic/components/searchbar/searchbar.ts index f5277fafd1..a050ba2620 100644 --- a/ionic/components/searchbar/searchbar.ts +++ b/ionic/components/searchbar/searchbar.ts @@ -39,7 +39,12 @@ export class SearchbarInput { * * @usage * ```html - * + * + * * ``` * * @demo /docs/v2/demos/searchbar/ @@ -47,6 +52,9 @@ export class SearchbarInput { */ @Component({ selector: 'ion-searchbar', + host: { + '[class.searchbar-hide-cancel]': 'hideCancelButton' + }, template: '
' + '