AOT编译的代码抛出错误 - 没有t

时间:2017-08-17 22:52:19

标签: angularjs cookies angular2-aot aot

运行角度应用程序时出现以下错误。前端采用角形,后端采用弹簧。

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 (

当我在网上搜索解决方案时,我遇到了一些帖子,他们提到这是因为一些CookieOptions。

在以下链接中,他们也提出了一些解决方案。

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

我尝试了以下内容:

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

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

当我构建时,我收到一条错误消息,指出“CookieService”未被'node_modules / angular2-cookie / services / cookies.service.js'导出

我应该怎么做才能正确导入它? 如果我需要提供任何其他信息,请告诉我?

编辑: 我现在可以使用以下

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

但是当我运行应用程序时,我收到了错误

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

1 个答案:

答案 0 :(得分:0)

angular2-cookie已弃用。您应该使用ngx-cookie