Skip to content

Commit

Permalink
Fixed #2: Un-selecting the selectedItems items #2
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPatel17 committed Jan 31, 2018
1 parent 9f747dd commit c6b1c93
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ yarn-error.log
# System Files
.DS_Store
Thumbs.db
yarn.lock
settings.json


TODO.md
TODO.md
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-multiselect-dropdown-base",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"description": "Angular Multi-Select Dropdown",
"scripts": {
Expand All @@ -23,6 +23,7 @@
"angular multiselect dropdown",
"angular2 multiselect dropdown",
"angular4 multiselect dropdown",
"ng multiselect dropdown",
"ng2 multiselect dropdown",
"ng4 multiselect dropdown"
],
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';

import { TabsModule, ButtonsModule } from 'ng2-bootstrap';
// import { Ng2MultiSelectDropDownModule } from '../ng-multiselect-dropdown/src';
import { Ng2MultiSelectDropDownModule } from 'ng-multiselect-dropdown';
import { Ng2MultiSelectDropDownModule } from '../ng-multiselect-dropdown/src';
// import { Ng2MultiSelectDropDownModule } from 'ng-multiselect-dropdown';

import { SelectSectionComponent } from './components/select-section';
import { SampleSectionComponent } from './components/sample-section.component';
Expand Down
19 changes: 7 additions & 12 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@

<head>
<meta charset="utf-8">
<title>Angular 2 Multi-Select Dropdown</title>
<title>Angular Multi-Select Dropdown</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A multiselect dropdown component for angular applications.">
<meta content='Angular dropdown, angular multiselect dropdown, ng-multiselect, ng-multiselect-dropdown' name='keywords'/>
<meta property="og:description" content="A multiselect dropdown component for angular applications."
/>
<meta property="og:url" content="/components/multiselectDropdown/" />
<meta property="article:tag" content="Angular" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<style media="screen">
/* .header {
background-color: #0143A3;
background: -webkit-linear-gradient(#0143A3, #0273D4);
background: linear-gradient(#0143A3, #0273D4);
color: #FFF;
}
section {
padding-top: 30px;
} */

.centered {
display: flex;
flex-direction: column;
Expand Down
8 changes: 4 additions & 4 deletions src/ng-multiselect-dropdown/src/multiselect.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ export class MultiSelectComponent implements OnInit, ControlValueAccessor {
this.onSelect.emit(this.emittedValue(item));
}

removeSelected(item: ListItem) {
this.selectedItems.forEach(itm => {
if (item.id === itm.id) {
removeSelected(itemSel: ListItem) {
this.selectedItems.forEach(item => {
if (itemSel.id === item.id) {
this.selectedItems.splice(this.selectedItems.indexOf(item), 1);
}
});
this.onChangeCallback(this.emittedValue(this.selectedItems));
this.onDeSelect.emit(this.emittedValue(item));
this.onDeSelect.emit(this.emittedValue(itemSel));
}

emittedValue(val: any): any {
Expand Down

0 comments on commit c6b1c93

Please sign in to comment.