Search code examples
angularjscookiesangular2-aotaot

AOT compiled code throws error - No provider for t


I am getting the following error when I run my angular application. Front end is in angular and back-end uses spring.

build.js:1 **EXCEPTION: Uncaught (in promise): Error: No provider for t!
Error: No provider for t!**

at e [as constructor] (http://localhost:8080/xo-as/ng/build.js:1:59315)

at e [as constructor] (http://localhost:8080/xo-as/ng/build.js:1:60416)
at new e (http://localhost:8080/xo-as/ng/build.js:1:60744)
at t._throwOrNull (http://localhost:8080/xo-as/ng/build.js:1:71064)
at t._getByKeyDefault (http://localhost:8080/xo-as/ng/build.js:1:71402)
at t._getByKey (http://localhost:8080/xo-as/ng/build.js:1:70782)
at t.get (http://localhost:8080/xo-as/ng/build.js:1:69150)
at e.get (http://localhost:8080/xo-as/ng/build.js:1:126499)
at e.t.injectorGet (http://localhost:8080/xo-as/ng/build.js:1:152798)
at e.get (

When I researched online for solutions I came across few posts where they mentioned it is because of some CookieOptions.

In the following link, they have suggested some solutions as well.

https://github.com/salemdar/angular2-cookie/issues/37

And I tried the following:

import { CookieService } from 'angular2-cookie/services/cookies.service';

import { CookieService, CookieOptions } from 'angular2-cookie/core';

When I build I am getting an error message saying 'CookieService' is not exported by 'node_modules/angular2-cookie/services/cookies.service.js'

What am I supposed to do to import it properly? Please let me know if I need to provide any other information?

Edit : I am able to import the CookieOptions now using the following

 import { CookieService, CookieOptions } from 'ngx-cookie';

But still when I run the application I am getting the error

Error: No provider for t! at e [as constructor]

Solution

  • angular2-cookie is deprecated. You should use ngx-cookie.