diff --git a/.angular-cli.json b/.angular-cli.json index 0af75be..4292e61 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -7,20 +7,15 @@ { "root": "src", "outDir": "dist", - "assets": [ - "assets", - "favicon.ico" - ], + "assets": ["assets", "favicon.ico"], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - "styles": [ - "styles.scss" - ], + "prefix": "ng", + "styles": ["styles.scss"], "scripts": [], "environmentSource": "environments/environment.ts", "environments": { diff --git a/package.json b/package.json index 08d3dce..51ae5b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng-multiselect-dropdown", - "version": "0.1.6", + "version": "0.1.7", "private": true, "description": "Angular Multi-Select Dropdown", "author": "Nilesh Patel", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7343b52..71d66e1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,8 +3,8 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { TabsModule, ButtonsModule } from 'ngx-bootstrap'; -// import { NgMultiSelectDropDownModule } from '../ng-multiselect-dropdown/src'; -import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; +import { NgMultiSelectDropDownModule } from '../ng-multiselect-dropdown/src'; +// import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; import { SelectSectionComponent } from './components/select-section'; import { SampleSectionComponent } from './components/sample-section.component'; diff --git a/src/app/components/select/multiple-demo.ts b/src/app/components/select/multiple-demo.ts index a4b8550..a262762 100644 --- a/src/app/components/select/multiple-demo.ts +++ b/src/app/components/select/multiple-demo.ts @@ -8,7 +8,7 @@ import { Component, OnInit } from '@angular/core'; export class MultipleDemoComponent implements OnInit { myForm: FormGroup; disabled = false; - ShowFilter = false; + ShowFilter = true; showAll = true; limitSelection = false; cities: Array = []; @@ -119,7 +119,13 @@ export class MultipleDemoComponent implements OnInit { onItemSelect(item: any) { console.log('onItemSelect', item); + console.log('form model', this.myForm.get('city').value); } + onItemDeSelect(item: any) { + console.log('onItem DeSelect', item); + console.log('form model', this.myForm.get('city').value); + } + onSelectAll(items: any) { console.log('onSelectAll', items); } diff --git a/src/app/components/select/single-demo.ts b/src/app/components/select/single-demo.ts index e50fab1..097b6a1 100644 --- a/src/app/components/select/single-demo.ts +++ b/src/app/components/select/single-demo.ts @@ -73,6 +73,7 @@ export class SingleDemoComponent implements OnInit { onItemSelect(item: any) { console.log('onItemSelect', item); + console.log('selectedItem', this.selectedItem); } toggleCloseDropdownSelection() { diff --git a/src/ng-multiselect-dropdown/src/multi-select.component.html b/src/ng-multiselect-dropdown/src/multi-select.component.html index 159b21f..b8ecca6 100644 --- a/src/ng-multiselect-dropdown/src/multi-select.component.html +++ b/src/ng-multiselect-dropdown/src/multi-select.component.html @@ -1,7 +1,7 @@
- {{placeholder}} + {{_placeholder}} {{item.text}} x diff --git a/src/ng-multiselect-dropdown/src/multiselect.component.ts b/src/ng-multiselect-dropdown/src/multiselect.component.ts index 9f7b87f..223f4ac 100644 --- a/src/ng-multiselect-dropdown/src/multiselect.component.ts +++ b/src/ng-multiselect-dropdown/src/multiselect.component.ts @@ -55,7 +55,7 @@ export class MultiSelectComponent implements ControlValueAccessor { public _data: Array = []; public selectedItems: Array = []; public isDropdownOpen = false; - + _placeholder: string = 'Select'; filter: ListItem = new ListItem(this.data); defaultSettings: DropdownSettings = { singleSelection: false, @@ -72,7 +72,14 @@ export class MultiSelectComponent implements ControlValueAccessor { closeDropDownOnSelection: false }; - @Input() placeholder = 'Select'; + @Input() + public set placeholder(value: string) { + if (value) { + this._placeholder = value; + } else { + this._placeholder = 'Select'; + } + } @Input() disabled = false; @Input() @@ -236,7 +243,7 @@ export class MultiSelectComponent implements ControlValueAccessor { } else { this.selectedItems.push(item); } - // this.onChangeCallback(this.emittedValue(this.selectedItems)); + this.onChangeCallback(this.emittedValue(this.selectedItems)); this.onSelect.emit(this.emittedValue(item)); } @@ -246,7 +253,7 @@ export class MultiSelectComponent implements ControlValueAccessor { this.selectedItems.splice(this.selectedItems.indexOf(item), 1); } }); - // this.onChangeCallback(this.emittedValue(this.selectedItems)); + this.onChangeCallback(this.emittedValue(this.selectedItems)); this.onDeSelect.emit(this.emittedValue(itemSel)); }