Prevent error message when not enough alphanum characters in term

Refs #195
This commit is contained in:
Will Abson
2016-06-27 10:01:42 +01:00
parent 68f67bef19
commit f78d88af06
2 changed files with 32 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ import { Control, Validators } from '@angular/common';
import { Component, Input, Output, EventEmitter, AfterViewInit } from '@angular/core';
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core';
import { AlfrescoSearchAutocompleteComponent } from './alfresco-search-autocomplete.component';
import { SearchTermValidator } from './../forms/search-term-validator';
declare let __moduleName: string;
declare var componentHandler: any;
@@ -66,7 +67,7 @@ export class AlfrescoSearchControlComponent implements AfterViewInit {
this.searchControl = new Control(
this.searchTerm,
Validators.compose([Validators.required, Validators.minLength(3)])
Validators.compose([Validators.required, SearchTermValidator.minAlphanumericChars(3)])
);
this.searchControl.valueChanges.map(value => this.searchControl.valid ? value : '')