I am currently developing a LoginComponent for my Angular application. Upon trying to navigate to it by pressing the button, an error is encountered:
core.mjs:10572 ERROR Error: Uncaught (in promise): Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203
Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203
at injectInjectorOnly (core.mjs:731:15)
at Module.ɵɵinject (core.mjs:744:60)
...
The login.component.ts file includes the following code snippet:
import { Component, inject } from '@angular/core';
...
It seems that the issue may be related to the CookieService. Despite spending the last few days reading their documentation, I have not been able to resolve this error.
The app.module.ts file contains:
import { NgModule } from '@angular/core';
...
Additionally, the auth.service.ts file is structured as follows:
import { Injectable } from '@angular/core';
...
If anyone has suggestions on how to address this problem, your insights would be greatly appreciated.