Я занимаюсь разработкой веб-портала с использованием Angular-7.Я получаю сообщение об ошибке и не знаю, как ее устранить:
ОШИБКА TypeError: Невозможно прочитать свойство «передано» из неопределенного
client-quote-landing.component
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ApiService } from '../../shared/services/api.service';
import { Router } from '@angular/router';
import { SnotifyService } from 'ng-snotify';
@Component({
selector: 'app-client-quotes-landing',
templateUrl: './client-quotes-landing.component.html',
styleUrls: ['./client-quotes-landing.component.scss']
})
export class ClientQuotesLandingComponent implements OnInit {
formattedAddress = '';
truck_types = [];
public form = {
first_name : null,
last_name : null,
email : null,
phone : null,
address : null,
business_name : null,
truck_required : null,
truck_type : null,
quote_origin : null,
quote_destination : null,
commodity : null,
loading_date : null,
comment : null,
};
public error = {
'first_name' : null,
'last_name' : null,
'email' : null,
'phone' : null,
'address' : null,
'business_name' : null,
'truck_required' : null,
'truck_type' : null,
'quote_origin' : null,
'quote_destination' : null,
'commodity' : null,
'loading_date' : null,
'comment' : null
};
constructor(
private api: ApiService,
private token: TokenService,
private router: Router,
private notify: SnotifyService
) {
}
ngOnInit() {
window.dispatchEvent(new Event('load'));
window.dispatchEvent(new Event('resize'));
}
onSubmit(){
var header = {
'Content-Type': 'application/json'
}
return this.api.post('clientquotelanding', this.form, header).subscribe(
},
);
}
}
Также у меня есть:
client-quote-Land.html
<form class="form-clientquote" #clientquoteForm=ngForm (ngSubmit)="onSubmit()">
<aw-wizard #wizard [navBarLayout]="'large-empty-symbols'">
<aw-wizard-step [stepTitle]="'Transaction Details'" [navigationSymbol]="{ symbol: '', fontFamily: 'FontAwesome' }">
<div class="centered-content">
<div class="row">
<div class="col-xs-12">
<div class="col-xs-6">
<label for="quote_origin" >Origin<span style="color:red;"> *</span></label>
<input type="text" class="form-control" id="quote_origin" placeholder="Origin" name="quote_origin" [(ngModel)]="form.quote_origin" #quote_origin="ngModel" [ngClass]="{'is-invalid' : quote_origin.invalid && ((quote_origin.dirty || quote_origin.touched) || quoteform.submitted)}" required>
<div class="form-feedback" *ngIf="quote_origin.invalid && ((quote_origin.dirty || quote_origin.touched) || quoteform.submitted)" class="invalid-feedback">
<div style="color:red;" *ngIf="quote_origin.errors?.required"class="alert alert-danger">Origin is required.</div>
</div>
</div>
<div class="col-xs-6">
<label for="quote_destination">Destination<span style="color:red;"> *</span></label>
<input type="text" class="form-control" id="quote_destination" placeholder="Destination" name="quote_destination" [(ngModel)]="form.quote_destination" #quote_destination="ngModel" [ngClass]="{'is-invalid' : quote_destination.invalid && ((quote_destination.dirty || quote_destination.touched) || quoteform.submitted)}" required>
<div class="form-feedback" *ngIf="quote_destination.invalid && ((quote_destination.dirty || quote_destination.touched) || quoteform.submitted)" class="invalid-feedback">
<div style="color:red;" *ngIf="quote_destination.errors?.required"class="alert alert-danger">Destination is required.</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-12">
<div class="btn-group">
<button type="button" class="btn btn-primary" awNextStep> Next ></button>
</div>
</div>
</div>
</div>
</div>
</aw-wizard-step>
<aw-wizard-step [stepTitle]="'Personal Details'" [navigationSymbol]="{ symbol: '', fontFamily: 'FontAwesome' }">
<div class="centered-content">
<div class="row">
<div class="col-xs-5">
</div>
<div class="col-xs-3" style="align:center;">
<h3 style="align:center;"><strong> Personal Details</strong></h3>
</div>
<div class="col-xs-4">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-6">
<label for="first_name">First Name<span style="color:red;"> *</span></label>
<input type="text" class="form-control" id="first_name" placeholder="First Name" name="first_name" [(ngModel)]="form.first_name" #first_name="ngModel" [ngClass]="{'is-invalid' : first_name.invalid && ((first_name.dirty || first_name.touched) || quoteform.submitted)}" required>
<div class="form-feedback" *ngIf="first_name.invalid && ((first_name.dirty || first_name.touched) || quoteform.submitted)" class="invalid-feedback">
<div style="color:red;" *ngIf="first_name.errors?.required" class="alert alert-danger">First Name is required.</div>
</div>
</div>
<div class="col-xs-6">
<label for="last_name">Last Name<span style="color:red;"> *</span></label>
<input type="text" class="form-control" id="last_name" placeholder="Last Name" name="last_name" [(ngModel)]="form.last_name" #last_name="ngModel" [ngClass]="{'is-invalid' : last_name.invalid && ((last_name.dirty || last_name.touched) || quoteform.submitted)}" required>
<div class="form-feedback" *ngIf="last_name.invalid && ((last_name.dirty || last_name.touched) || quoteform.submitted)" class="invalid-feedback">
<div style="color:red;" *ngIf="last_name.errors?.required"class="alert alert-danger">Last Name is required.</div>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-12">
<div class="btn-group">
<button style="margin:5px" type="button" class="btn btn-warning" awPreviousStep>< Previous</button>
<button style="margin:5px" type="submit" class="btn btn-success" > Get A Quote</button>
</div>
</div>
</div>
</div>
</div>
</aw-wizard-step>
</aw-wizard>
</form>
Когда я обслуживал приложение, я получил эту ошибку на консоли:
Затем, когда я нажал на строку 29 об ошибке, я нашел это:
Кроме того, строка 48 дает мне это:
Как мне устранить эту ошибку?