How can I go about creating or injecting a tree-shakable service? I've scoured the documentation but can't seem to find any information on it. Do you think I'm doing it correctly?
@Injectable({
providedIn: 'root',
})
export class ExampleService {
}
import { ExampleService } from './example.service';
@Component({
selector: 'app-test',
template: ``,
providers: { provide: AuthService, useClass: AuthService}
})
export class MyComponent {
}
When it comes to performance, using providedIn is more efficient.
@Injectable({
providedIn: 'root',
})
Or without providedIn
@Injectable
Thanks, Andrea