mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -17,10 +17,11 @@
|
||||
|
||||
import { Control, Validators } from 'angular2/common';
|
||||
import { Component, Input, Output, EventEmitter, AfterViewInit } from 'angular2/core';
|
||||
import { AlfrescoService } from './../services/alfresco.service';
|
||||
|
||||
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||
|
||||
import { AlfrescoSearchAutocompleteComponent } from './alfresco-search-autocomplete.component';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare var componentHandler: any;
|
||||
|
||||
@@ -30,7 +31,7 @@ declare var componentHandler: any;
|
||||
styles: [
|
||||
],
|
||||
templateUrl: './alfresco-search-control.component.html',
|
||||
providers: [AlfrescoService],
|
||||
directives: [AlfrescoSearchAutocompleteComponent],
|
||||
pipes: [AlfrescoPipeTranslate]
|
||||
})
|
||||
export class AlfrescoSearchControlComponent implements AfterViewInit {
|
||||
@@ -52,6 +53,9 @@ export class AlfrescoSearchControlComponent implements AfterViewInit {
|
||||
|
||||
searchControl: Control;
|
||||
|
||||
@Input()
|
||||
autocompleteSearchTerm = '';
|
||||
|
||||
constructor(private translate: AlfrescoTranslationService) {
|
||||
|
||||
this.searchControl = new Control(
|
||||
@@ -59,6 +63,12 @@ export class AlfrescoSearchControlComponent implements AfterViewInit {
|
||||
Validators.compose([Validators.required, Validators.minLength(3)])
|
||||
);
|
||||
|
||||
this.searchControl.valueChanges.debounceTime(400).distinctUntilChanged().subscribe(
|
||||
(value: string) => {
|
||||
this.autocompleteSearchTerm = value;
|
||||
}
|
||||
);
|
||||
|
||||
translate.addTranslationFolder('node_modules/ng2-alfresco-search');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user