Skip to content

Commit

Permalink
fix: mark for check when closing dropdown (#140)
Browse files Browse the repository at this point in the history
fixes #138
  • Loading branch information
anjmao committed Nov 26, 2017
1 parent 63d9f70 commit 78ff661
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 9 deletions.
5 changes: 3 additions & 2 deletions demo/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '../style/styles.scss';

import { Component } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';
Expand All @@ -9,7 +9,8 @@ import { Title } from '@angular/platform-browser';

@Component({
selector: 'demo-app',
templateUrl: './app.component.html'
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {

Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/bindings.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {Component} from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
selector: 'select-bindings',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<label>Bind to default <b>label</b>, <b>object</b> bindings</label>
---html,true
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/custom-templates.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
selector: 'select-with-templates',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<label>Custom label</label>
---html,true
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/events.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';


interface AngSelectEvent {
Expand All @@ -8,6 +8,7 @@ interface AngSelectEvent {

@Component({
selector: 'select-events',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div id="s1"></div>
<label>Open, close, focus, blur, change events</label>
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/multi.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { NgOption } from '@ng-select/ng-select';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<label>Select multiple elements</label>
---html,true
Expand Down
1 change: 1 addition & 0 deletions demo/app/examples/reactive-forms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DataService } from '../shared/data.service';

@Component({
selector: 'reactive-forms',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<form [formGroup]="heroForm" novalidate>
---html
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/search.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter } from '@angular/core';
import { Component, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/distinctUntilChanged';
Expand All @@ -9,6 +9,7 @@ import { DataService } from '../shared/data.service';

@Component({
selector: 'select-search',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<h5>Default search</h5>
<hr>
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/tags.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component, EventEmitter } from '@angular/core';
import { Component, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

@Component({
selector: 'select-tags',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<label>Default tags</label>
---html,true
Expand Down
3 changes: 2 additions & 1 deletion demo/app/examples/virtual-scroll.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component } from '@angular/core';
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Component({
selector: 'select-tags',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<p>
By default ng-select enables virtual scroll for more 20 items. You can turn it off by setting disableVirtualScroll to true.
Expand Down
2 changes: 2 additions & 0 deletions src/ng-select/ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,12 @@ export class NgSelectComponent implements OnInit, OnDestroy, OnChanges, AfterVie

if (this.isFocused) {
this.onInputBlur();
this.changeDetectorRef.markForCheck();
}

if (this.isOpen) {
this.close();
this.changeDetectorRef.markForCheck();
}
};

Expand Down

0 comments on commit 78ff661

Please sign in to comment.