[英]Using realative paths in Angular: Cannot find module
您好,我正在嘗試從 Angular 中的不同組件導入 class。 但我不斷收到錯誤錯誤:
Cannot find module './app/_services/modal.service' or its corresponding type declarations.
我的導入語句看起來像這樣
import {ModalService} from './app/_services/modal.service';
我的目錄樹看起來像這樣,我正在嘗試將 go 從聊天組件到 _services:
您應該從 src 文件夾src/app/_services/modal.service
開始導入路徑,或者您應該向后移動兩個文件夾以到達 _services 文件夾../../_services/modal.service
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.