确切的错误:
HostResourceResolver中的错误:无法在D:/MEAN/MEAN/src/app/components/employee-list/employee-list.component.ts)中解析./employee-list.component.css
这是我的employee-list.component.ts文件:
import {Router} from '@angular/router';
import {ApiService} from '../../service/api.service';
import {Component, OnInit, NgZone} from '@angular/core';
import {FormGroup, FormBuilder, Validators} from '@angular/forms';
@Component({
selector: 'app-employee-create',
templateUrl: './employee-create.component.html',
styleUrls: ['./employee-create.component.scss']
})
export class EmployeeCreateComponent implements OnInit {
submitted = false;
employeeForm: FormGroup;
EmployeeProfile: any = ['Finance', 'BDM', 'HR', 'Sales', 'Admin']
constructor(
public fb: FormBuilder,
private router: Router,
private ngZone: NgZone,
private apiService: ApiService
) {
this.mainForm();
}
ngOnInit() {
}
mainForm() {
this.employeeForm = this.fb.group({
name: ['', [Validators.required]],
email: ['', [Validators.required, Validators.pattern('[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$')]],
designation: ['', [Validators.required]],
phoneNumber: ['', [Validators.required, Validators.pattern('^[0-9]+$')]]
});
}
// Choose designation with select dropdown
updateProfile(e) {
this.employeeForm.get('designation').setValue(e, {
onlySelf: true
});
}
// Getter to access form control
get myForm() {
return this.employeeForm.controls;
}
onSubmit() {
this.submitted = true;
if (!this.employeeForm.valid) {
return false;
} else {
this.apiService.createEmployee(this.employeeForm.value).subscribe(
(res) => {
console.log('Employee successfully created!')
this.ngZone.run(() => this.router.navigateByUrl('/employees-list'))
}, (error) => {
console.log(error);
});
}
}
}
我的employee-list.component.scss文件为空。 我正在学习角度问题,我不知道该如何解决。请引导我。