2016-07-27 91 views
1

app.js遗漏的类型错误:无法读取的不确定

service.js

财产 'currentUser' 当我在控制台本地主机上运行我有错误

bundle.js:7541 Uncaught TypeError: Cannot read property 'currentUser' of undefined(anonymous function) @ bundle.js:7541invoke @ bundle.js:12268(anonymous function) @ bundle.js:12076forEach @ bundle.js:7880createInjector @ bundle.js:12076doBootstrap @ bundle.js:9310bootstrap @ bundle.js:9331angularInit @ bundle.js:9216(anonymous function) @ bundle.js:39027j @ jquery.js:3047fireWith @ jquery.js:3159ready @ jquery.js:3365I @ jquery.js:3380

请帮助(我想我忘了什么事)

+0

这是相当果然错误。 Angular中的服务是懒惰的实例化组件。我没有注意到你在哪里使用'AuthenticationService' –

回答

0

在app.js里面有$ window.localStorage.currentUser。

$ window.localStorage未定义,所以你得到的错误找不到currentUser的undefined。

变化:如果($ window.localStorage & & $ window.localStorage.currentUser)

相关问题