From f204dade21d3e5837135d91264a7c55ebb072f9f Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Mon, 7 Oct 2019 12:34:57 -0400 Subject: [PATCH 1/2] CHORE: Add Placeholder Binding to GoSelect Some implementations of select boxes require a placeholder to be designated for that select box. With our current version of the GoSelect component, we are not capable of adding a placeholder value. The NgSelect module allows us to pass it a placeholder for the select box. This adds the placeholder option as a binding to the GoSelect component and then leverages that binding when creating an NgSelect instance. I leverged the HTML for Template/Header/Footer[0] example that NgSelect provides in order to best implement this solution. [0] - https://github.com/ng-select/ng-select/blob/master/src/demo/app/examples/template-header-footer-example/template-header-footer-example.component.html --- .../src/lib/components/go-select/go-select.component.html | 3 ++- .../go-lib/src/lib/components/go-select/go-select.component.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/go-lib/src/lib/components/go-select/go-select.component.html b/projects/go-lib/src/lib/components/go-select/go-select.component.html index 9c9226709..7a5118c82 100644 --- a/projects/go-lib/src/lib/components/go-select/go-select.component.html +++ b/projects/go-lib/src/lib/components/go-select/go-select.component.html @@ -11,7 +11,8 @@ [bindLabel]="bindLabel" [bindValue]="bindValue" [multiple]="multiple" - [formControl]="control"> + [formControl]="control" + [placeholder]="placeholder"> diff --git a/projects/go-lib/src/lib/components/go-select/go-select.component.ts b/projects/go-lib/src/lib/components/go-select/go-select.component.ts index 9c2bc3240..722b8a126 100644 --- a/projects/go-lib/src/lib/components/go-select/go-select.component.ts +++ b/projects/go-lib/src/lib/components/go-select/go-select.component.ts @@ -18,6 +18,7 @@ export class GoSelectComponent implements OnInit { @Input() key: string; @Input() label: string; @Input() multiple: boolean = false; + @Input() placeholder: string; @Input() theme: 'light' | 'dark' = 'light'; ngOnInit(): void { From 8e27f46b82cb95a4b48792416d082c804f4de7db Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Mon, 7 Oct 2019 12:43:04 -0400 Subject: [PATCH 2/2] Add Placeholder to Test Project --- .../src/app/components/test-page-3/test-page-3.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/go-tester/src/app/components/test-page-3/test-page-3.component.html b/projects/go-tester/src/app/components/test-page-3/test-page-3.component.html index 2fe385d79..1cf9c36de 100644 --- a/projects/go-tester/src/app/components/test-page-3/test-page-3.component.html +++ b/projects/go-tester/src/app/components/test-page-3/test-page-3.component.html @@ -104,6 +104,7 @@

bindValue="value" bindLabel="name" [hints]="['Select an option here, whatever you want']" + placeholder="Select Box Placeholder" label="Select Box Here">