import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonContent, IonHeader, IonTitle, IonToolbar, IonButton, IonInput, IonChip, IonItem, IonList } from '@ionic/angular/standalone';

@Component({
  selector: 'app-edit-tag',
  templateUrl: './edit-tag.component.html',
  styleUrls: ['./edit-tag.component.scss'],
  standalone: true,
  imports: [IonContent, IonHeader, IonTitle, IonToolbar, CommonModule, FormsModule,IonButton,IonInput,IonChip,IonItem,IonList]

})
export class EditTagComponent  implements OnInit {
  public inputValue = ""
  public gptre = ""
  tags:Array<string>=[]

  userInputText:string=""
  onInput(event:any){
  this.userInputText=  event.detail.value
    
  }
  deleteTag(tag:string){
    let idx=this.tags.findIndex(item=>item==tag)
    this.tags.splice(idx,1)

  }
  addtag(){
    this.tags.push(this.userInputText);
    this.userInputText=""
    this.onTagChange.emit(this.tags)
  }
  @Output()
  onTagChange:EventEmitter<Array<string>>=new EventEmitter<Array<string>>()
  constructor() { }

  ngOnInit() {
  }
  

  
}
