Я создал эту форму, используя построитель форм в угловом формате, но она выдает ошибку в консоли.
Ошибка:
compiler.js: 1021 Неопределенная ошибка: Ошибки синтаксического анализа шаблона:Неожиданный символ "EOF" ("rity.value, liability.value)" mat-поднял-button-color = "primary"> Сохранить
код:
<mat-card>
<form [formGroup]="createForm" class="create-form">
<mat-form-field class="field-full-width">
<input matInput placeholder="Title" formControlName="title" #title>
</mat-form-field>
<mat-form-field class="field-full-width">
<input matInput placeholder="Responsible" formControlName="responsible" #responsible>
</mat-form-field>
<mat-form-field class="field-full-width">
<textarea matInput placeholder="Description" formControlName="description" #description>
</mat-form-field>
<mat-form-field class="field-full-width">
<mat-select placeholder="Severity" formControlName="severity" #severity>
<mat-option value="low">Low</mat-option>
<mat-option value="medium">Medium</mat-option>
<mat-option value="high">High</mat-option>
</mat-select>
</mat-form-field>
<mat-divider></mat-divider>
<br>
<br>
<button mat-raised-button color="accent" routerLink="/list">Back</button>
<button type="submit" (click)="addIssue(title.value, description.value, severity.value, responsible.value)" mat-raised-button color="primary">Save</button>
</form>
</mat-card>
.ts
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import {IssueService} from '../../../issue.service';
@Component({
selector: 'app-create',
templateUrl: './create.component.html',
styleUrls: ['./create.component.css']
})
export class CreateComponent implements OnInit {
createForm: FormGroup;
constructor(private Issue: IssueService, private router: Router, private fb: FormBuilder) {
this.createForm = this.fb.group({
title: '',
description: '',
severity: '',
responsible: ''
});
}
addIssue(title, description, responsible, severity) {
this.Issue.addIssue(title, description, severity, responsible).subscribe(() => {
console.log('Issue added');
this.router.navigate(['/list']);
});
}
ngOnInit() {
}
}