134 questions
2
votes
2
answers
181
views
Angular 19 Standalone Component Error: "No provider for _HttpClient" Despite HttpClientModule Imported
I am working on an Angular standalone application and encountering the following error when using HttpClient in my DataService:
ERROR Error [NullInjectorError]: R3InjectorError(Standalone[...
1
vote
1
answer
36
views
Angular DI for standalone components with importing module on parent component and child component (NullInjectorError: R3InjectorError)
Given the following structure:
a parent standalone component named AppComponent
a child standalone component called TableComponent, which should be a wrapper for a generic table
TableComponent ...
1
vote
1
answer
45
views
Troubleshooting NG0203 Error: Issues with Angular Library and HttpClient Injection in Production Build
I wasn't able to solve it. I'm counting on your help.
I have an Angular application and a library.
In the library, I have a service where I inject HttpClient. I set HttpClient as a provider in the ...
5
votes
2
answers
310
views
How to access provider value in Angular 19
Using Angular SSR, I would like to access a server-side value in my app.component.
Here is my server-side route:
app.get('**', (req, res, next) => {
const { protocol, originalUrl, baseUrl, ...
3
votes
1
answer
80
views
Can we remove all the constructor-based injections?
Recently, Angular put in place a migration to replace constructor-based injection with inject function.
In most of the cases, it is straightforward and it clearly has benefits:
// before
@Injectable({ ...
1
vote
2
answers
83
views
How to inject a Service inside ApplicationConfig?
How to inject a Service inside ApplicationConfig?
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(appRoutes),
provideTransloco({
config: {
...
1
vote
0
answers
33
views
Using Injector.create() to dynamically create injector for embedded view is not working when parent injector is provided via parent property
I want to dynamically create the injector for embeddedView and for that purpose I use Injector.create() method:
const myInjector = Injector.create({
providers: [
{
...
1
vote
1
answer
40
views
Injecting a service in Angular using a Symbol does not work in Firefox
My Angular app works in Chrome.
export interface UserService {
me(): Observable<Response<User>>;
}
export const UserServiceRef = Symbol();
----
providers: [
{
provide: ...
0
votes
2
answers
152
views
Angular 18 Multiple instance of same service
I've:
service DataLoader who read/write data in DB.
service Report who instances DataLoader using inject
standalone component who inject DataLoader and Report too.
At this point, only one instance of ...
0
votes
0
answers
59
views
Why Angular provider is not detectedin standalone component?
I have a component, which I will build using my custom builder. This builder builds my component in ESM format.
My component code (which will be built) is a simple standalone component which imports ...
3
votes
1
answer
1k
views
Angular Standalone - How to Inject Service into Service
I'm a longtime Angular dev now trying to learn the standalone version. How do I inject a service into another service without a providers array in the NgModule. Is my only choice using providedIn in ...
0
votes
1
answer
70
views
Angular component with content projection causes incorrect service injection
I have an Angular directive (LevelDirective) designed to determine its level based on its parent's level (i.e. if parent has level 1 => I should have level 2). It uses a standalone LevelService to ...
1
vote
1
answer
86
views
Angular Service State Not Updating for Subscribers Even After Using BehaviorSubject
I'm working on an Angular service that fetches rules from a secondary cart and updates a BehaviorSubject to manage the state. However, my subscribers are not receiving updates even after the state is ...
2
votes
1
answer
423
views
DOCUMENT injection token for SSR angular service causes NotYetImplemented error
I have an Angular SSR app with a service that references document. I use the DOCUMENT injection token to provide document as a DI. Here is the repo: https://github.com/JakeLo123/ng-ssr
import { Inject,...
2
votes
1
answer
291
views
Injecting document into angular service for SSR
I am creating an angular library that has a root-level service class that references document. I'd like to add SSR support, but of course document is not defined in SSR context. It seems that Angular ...