Boa noite, estou com um erro e não estou conseguindo arrumar.
ERROR in src/app/photos/photo-form/photo-form.component.ts(33,30): error TS2345: Argument of type 'AbstractControl' is not assignable to parameter of type 'string'.
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { PhotoService } from '../photo/photo.service';
import { Router } from '@angular/router';
@Component({
selector: 'ap-photo-form',
templateUrl: './photo-form.component.html',
styleUrls: ['./photo-form.component.css']
})
export class PhotoFormComponent implements OnInit {
photoForm: FormGroup;
file: File;
constructor(
private formBuilder: FormBuilder,
private photoService: PhotoService,
private router: Router
) { }
ngOnInit(): void {
this.photoForm = this.formBuilder.group({
file: ['', Validators.required],
description: ['', Validators.maxLength(300)],
allowComments: [true]
});
}
upload() {
const description = this.photoForm.get('description');
const allowComments = this.photoForm.get('allowComments');
this.photoService.upload(description, allowComments, this.file)
.subscribe(() => this.router.navigate(['']))
}
}