2016-07-27 11 views
1

app.jsキャッチされない例外TypeError:プロパティを読み取ることができません未定義

service.js

の 'CurrentUserに' 私はコンソールではlocalhostを実行すると、私はエラー

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を見つけることができないエラーが発生します。

変化に:もし($ window.localStorage & & $ window.localStorage.currentUser)

関連する問題