Skip to content

Commit

Permalink
Merge branch 'master' into deferred-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gund committed Jul 14, 2017
2 parents c623fd5 + 34e8065 commit e428b17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See demo: http://softsimon.github.io/angular-2-dropdown-multiselect
* [Download the latest release](https://github.com/softsimon/angular-2-dropdown-multiselect/releases).
* Clone the repo: `git clone https://github.com/softsimon/angular-2-dropdown-multiselect.git`.
* Install with [Bower](http://bower.io): `bower install angular-2-dropdown-multiselect --save`.
* Install with [npm](https://www.npmjs.com): `npm install angular-2-dropdown-multiselect --save-dev`.
* Install with [npm](https://www.npmjs.com): `npm install angular-2-dropdown-multiselect --save`.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-2-dropdown-multiselect",
"version": "1.4.12",
"version": "1.4.2",
"description": "Customizable dropdown multiselect in Angular 2 with bootstrap css.",
"main": "dist/bundles/dropdown.umd.js",
"module": "dist/index.js",
Expand Down
11 changes: 8 additions & 3 deletions src/dropdown/dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export class MultiselectDropdown implements OnInit, OnChanges, DoCheck, OnDestro
private fb: FormBuilder,
differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
this.settings = this.defaultSettings;
this.texts = this.defaultTexts;
}

getItemStyle(option: IMultiSelectOption): any {
Expand Down Expand Up @@ -155,7 +157,10 @@ export class MultiselectDropdown implements OnInit, OnChanges, DoCheck, OnDestro
.filter(option => typeof option.parentId === 'number')
.map(option => option.parentId);
this.updateRenderItems();
this.updateTitle();

if (this.texts) {
this.updateTitle();
}
}

if (changes['texts'] && !changes['texts'].isFirstChange()) {
Expand Down Expand Up @@ -291,9 +296,9 @@ export class MultiselectDropdown implements OnInit, OnChanges, DoCheck, OnDestro

updateTitle() {
if (this.numSelected === 0 || this.settings.fixedTitle) {
this.title = this.texts.defaultTitle || '';
this.title = (this.texts) ? this.texts.defaultTitle : '';
} else if (this.settings.displayAllSelectedText && this.model.length === this.options.length) {
this.title = this.texts.allSelected || '';
this.title = (this.texts) ? this.texts.allSelected : '';
} else if (this.settings.dynamicTitleMaxItems && this.settings.dynamicTitleMaxItems >= this.numSelected) {
this.title = this.options
.filter((option: IMultiSelectOption) =>
Expand Down

0 comments on commit e428b17

Please sign in to comment.