Reputation: 4745
What is the correct syntax for my file path to import my service? I have a data service that I want to import into my component, it's file path is here:
C:\Users\jlz\Documents\Git\Pantheon\Ceto-www\src\app\services\ceto-data\data.service.ts
My component file is located here:
C:\Users\jlz\Documents\Git\Pantheon\Ceto-www\src\app\querypageheader\querypageheader.component.ts
My import statement looks like this:
import { DataService } from './data.service';
I've tried various different file paths, but none came out correct. The error I get is my file path can't locate DataService.
Upvotes: 2
Views: 563
Reputation: 222582
Change it as,
import { DataService } from './../services/ceto-data/data.service';
You can simply use VSCode
, it will automatically import the path for you.
Upvotes: 3