import { Component, OnInit } from '@angular/core'; import { CompleterService } from 'ng2-completer'; import { DefaultEditor } from './default-editor'; @Component({ selector: 'completer-editor', template: ` `, }) export class CompleterEditorComponent extends DefaultEditor implements OnInit { completerStr: string = ''; constructor(private completerService: CompleterService) { super(); } ngOnInit() { if (this.cell.getColumn().editor && this.cell.getColumn().editor.type === 'completer') { const config = this.cell.getColumn().getConfig().completer; config.dataService = this.completerService.local(config.data, config.searchFields, config.titleField); config.dataService.descriptionField(config.descriptionField); } } onEditedCompleter(event: { title: '' }): boolean { this.cell.newValue = event.title; return false; } }