'Unexpected token. A constructor, method, accessor, or property was expected.ts(1068)

  • import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { BackendcallService } from 'src/app/services/backendcall.service';

  • List itementer code here

     @Component({
       selector: 'app-add-event',
       templateUrl: './add-event.component.html',`enter code here`
       styleUrls: ['./add-event.component.scss']
     })
     export class AddEventComponent implements OnInit {
       EventForm =new FormGroup({
         eventTitle: new FormControl(""),
         eventCategory: new FormControl(""),
         eventPlace: new FormControl(""),
         eventAddress: new FormControl(""),
         eventDescription:new FormControl(""),
    
       });
       fileToUpload:any;
       locations:eventDetails[];
       showSuccessMessage= false;
       showErrorMessage=false;
       FailedErrorDetails: any;
    
       constructor(private  fb : FormBuilder,
         private backendCallService: BackendcallService) {
           this.locations = [];
          }
       ngOnInit(): void {
         this.loadLocations();
       }
     loadLocations(){
       this.backendCallService.httpPost("",'netr/event/createEvent?apiVersion=1').subscribe(x=>{
         if(x.internalMessage === "Event retrived successfully"){
           this.locations = x.data;
           console.log(this.locations);
    
         }
       });
     }
     handleFileInput(files:any) {
       this.fileToUpload = files.files.item(0);
     }
     SaveData(){
       const userDetails = localStorage.getItem("user");
       const userID = userDetails != null ? JSON.parse(userDetails).userId: "";
       const formData = this.EventForm.value;
       console.log(formData);
       if(formData.eventDescription && formData.eventLocation){
       const dataToSendFormObj  = new FormData();
       dataToSendFormObj.append("userId", userID);
       dataToSendFormObj.append("text", formData.eventDescription);
       dataToSendFormObj.append("location", formData.address);
     }
     }
       export interface eventDetails {
         id:numb`enter code here`erenter code here
       }`enter code here`
    


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source