import {Component, OnInit} from '@angular/core'; import {BaseComponent} from '../base-page/base.component'; import {ConfigService} from '../../config.service'; @Component({ selector: 'framadate-answers', templateUrl: './answers.component.html', styleUrls: ['./answers.component.scss'] }) export class AnswersComponent extends BaseComponent implements OnInit { private answerList=[]; constructor(config: ConfigService) { super(config); this.answerList = this.config.answers; } // todo, manage validation of each page in a common way ngOnInit() { } trackFunction(index: number, item: any): number { return item.id; } // add a new answer on the press of ENTER in an input addWhenEnterKey(event) { console.log('event', event); if (event.keyCode === 13) { this.config.addAnswer(); } return; } }