2016-06-22 1 views
1

私はいくつかの基本的な角度で遊んでいました。いくつかの時点で私は文字/アルファベットはエラーで表示されます ""エラー:不明なプロバイダ:bProvider < - b "?"

"Error: Unknown provider: bProvider <- b".

は私が依存関係を注入しなかったことを考え出したというエラーメッセージが表示されましたが、何が「b」は表していますか?記事から

+1

コードを投稿してください。 – Chinni

+0

https://groups.google.com/forum/#!topic/angular/2gpf8Ea-PFQ –

答えて

0

https://groups.google.com/forum/#!topic/angular/2gpf8Ea-PFQ

The problem is your production code is minifying your opentaste.js.

One trick minifiers use is to rename variables and arguments inside functions, because their scope can be easily reasoned about, so renaming them is of no consequence (except saving bytes).

The problem is angular actually uses the names of function parameters (by actually reading your code) to determine what dependencies need to be loaded. If your controller has a $scope argument, it passes the appropriate value. The problem is the minifier changed '$scope' to 'b' (or something meaningful to something meaningless)

Read http://docs.angularjs.org/guide/di , specifically $inject Annotation and Inline Annotation. These are methods for defining explicitly what your arguments/dependencies are, in such a way that angular doesn't have to read your code to figure it out. These techniques work because the minifier won't change the values of strings for obvious reasons.

It's a bit more code, a bit less 'magic', but necessary if you plan to minify your AngularJS code.

関連する問題