Elly
Elly

Reputation: 1

Angular: cookie service Error Reference: i0

This error message in the browser console appears after I added the CookieService to my Angular app: "Error: Uncaught (in promise): ReferenceError: i0 is not defined." Here is the code related to the cookie:

    import { CookieService } from 'ngx-cookie-service';
    constructor(
        private cookieService: CookieService )
    ngOnInit(): void
{
    // Create the form
    this.signInForm = this._formBuilder.group({
        email     : ['[email protected]', [Validators.required, Validators.email]],
        password  : ['admin', Validators.required],
        rememberMe: ['']
    });
    if (this.signInForm.get('rememberMe').value) {
            const email = this.signInForm.get('email').value;
            this.cookieService.set('rememberedEmail', email, 30); 
            // cookie will expire in 30 days
          }

I already rectified the imports and install cookie-service but still don't work.

Upvotes: 0

Views: 118

Answers (1)

Manolo de la Vega
Manolo de la Vega

Reputation: 333

Could be a issue with the ngx-cookie-service version installed.

I had this error message when I updated then downgraded my angular webapp, the compiler option in tsconfig.json were changed and caused a similar error message. Specifically, these lines :

"compilerOptions": {
   ...
  "target": "es2017",
  "module": "es2020"
}

Upvotes: 0

Related Questions