I am experiencing an issue with my TypeScript file, here is a snippet of the code:
import { Component, OnInit } from '@angular/core';
import { BookService } from "../../services/book.service";
import { Book } from "../../Models/book";
@Component({
selector: 'app-book-list',
templateUrl: './book-list.component.html',
styleUrls: ['./book-list.component.css']
})
export class BookListComponent implements OnInit {
books: Book[];
constructor(private bookService: BookService) {
}
ngOnInit() {
this.bookService.getBooks()
.subscribe(books => this.books = books);
}
}
The problem arises during compilation as it can't locate the Book.cs file. Here is the error message:
(TS) Cannot find Module '../../Models/Book'
What's confusing is that I used Visual Studio intellisence to construct the path, so technically it should be correct. My project structure is shown below:
https://i.sstatic.net/ly4yF.png
If anyone could shed some light on what might be going wrong here, I would appreciate it.