0

The Exact Error:

ERROR in HostResourceResolver: could not resolve ./employee-list.component.css in context of D:/MEAN/MEAN/src/app/components/employee-list/employee-list.component.ts)

This is my employee-list.component.ts file:

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);
        });
    }
  }

}

My employee-list.component.scss file is empty. I am learning angular and I don't know how to resolve this. Please guide me.

Ahmed Fiaz
  • 11
  • 3
  • Are you sure you have `employee-list.component.css` file? NOTE - the compiler is looking for css file not scss file. – user2216584 Sep 14 '20 at 21:43
  • Actually, No. All the style files are formatted in SCSS format in my project. Also This happened after I installed bootstrap into my project. Could you guide me what changes to make? – Ahmed Fiaz Sep 14 '20 at 22:10
  • Delete the css file for that component. Or just move all files out one folder and then move back in. – JWP Sep 15 '20 at 04:07

0 Answers0