diff --git a/components/select/demo/automatic-tokenization.ts b/components/select/demo/automatic-tokenization.ts index d0b8951f73d..77654faf59f 100644 --- a/components/select/demo/automatic-tokenization.ts +++ b/components/select/demo/automatic-tokenization.ts @@ -3,14 +3,20 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'nz-demo-select-automatic-tokenization', template: ` - + ` }) export class NzDemoSelectAutomaticTokenizationComponent implements OnInit { listOfOption: Array<{ label: string; value: string }> = []; - listOfTagOptions = null; + listOfTagOptions = []; ngOnInit(): void { const children: Array<{ label: string; value: string }> = []; diff --git a/components/select/demo/select-users.ts b/components/select/demo/select-users.ts index 9ad830a11b6..3bf53ab38f2 100644 --- a/components/select/demo/select-users.ts +++ b/components/select/demo/select-users.ts @@ -36,7 +36,7 @@ export class NzDemoSelectSelectUsersComponent implements OnInit { randomUserUrl = 'https://api.randomuser.me/?results=5'; searchChange$ = new BehaviorSubject(''); optionList: string[] = []; - selectedUser = ''; + selectedUser: string; isLoading = false; onSearch(value: string): void { diff --git a/components/select/nz-option-container.component.ts b/components/select/nz-option-container.component.ts index ed75b41b080..1da854c1539 100644 --- a/components/select/nz-option-container.component.ts +++ b/components/select/nz-option-container.component.ts @@ -31,6 +31,7 @@ import { NzSelectService } from './nz-select.service'; }) export class NzOptionContainerComponent implements OnDestroy, OnInit { private destroy$ = new Subject(); + private lastScrollTop = 0; @ViewChildren(NzOptionLiComponent) listOfNzOptionLiComponent: QueryList; @ViewChild('dropdownUl') dropdownUl: ElementRef; @Input() nzNotFoundContent: string; @@ -78,7 +79,8 @@ export class NzOptionContainerComponent implements OnDestroy, OnInit { .subscribe(e => { e.preventDefault(); e.stopPropagation(); - if (ul && ul.scrollHeight < ul.clientHeight + ul.scrollTop + 10) { + if (ul && ul.scrollTop > this.lastScrollTop && ul.scrollHeight < ul.clientHeight + ul.scrollTop + 10) { + this.lastScrollTop = ul.scrollTop; this.ngZone.run(() => { this.nzScrollToBottom.emit(); });