Reputation: 121
i am searching for this path for hours now and hope you could help me. I created a service and want to access it from my components.
My files are organized like that:
I want to import "shared.service.ts" to "main-quiz.component.ts.
I already tried
import { SharedService } from './shared,service';
import { SharedService } from '././shared,service';
import { SharedService } from 'src/app/shared.service';
I really dont know why that is not working... Please help me, thanks!
Upvotes: 0
Views: 292
Reputation: 514
import { SharedService} from '../shared.service;
Which means "I want to find the file from the directory above"
Likewise , if it was two directories above , you'd do something like: '../../filename'
Upvotes: 1
Reputation: 1393
import { SharedService } from '../shared.service';
where .. is parent directory
Upvotes: 0