Podcast/lib/angular/docs/partials/error/$injector:unpr.html
2013-08-21 19:46:51 +02:00

23 lines
1.3 KiB
HTML
Executable file

<a href="http://github.com/angular/angular.js/edit/master/docs/content/error/injector/unpr.ngdoc" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Unknown Provider</code>
<div><span class="hint">error in component <code ng:non-bindable="">$injector</code>
</span>
</div>
</h1>
<div><pre class="minerr-errmsg" error-display="Unknown provider: {0}">Unknown provider: {0}</pre>
<h2 id="Description">Description</h2>
<div class="description"><div class="-injector-page -injector-unpr-page"><p>This error results from the <code>$injector</code> being unable to resolve a required
dependency. To fix this, make sure the dependency is defined and spelled
correctly. For example:</p>
<pre><code>angular.module(&#39;myApp&#39;, [])
.controller(&#39;myCtrl&#39;, [&#39;myService&#39;, function (myService) {
// Do something with myService
}]);</code></pre>
<p>This code will fail with <code>$injector:unpr</code> if <code>myService</code> is not defined. Making
sure each dependency is defined will fix the problem.</p>
<pre><code>angular.module(&#39;myApp&#39;, [])
.service(&#39;myService&#39;, function () { /* ... */ })
.controller(&#39;myCtrl&#39;, [&#39;myService&#39;, function (myService) {
// Do something with myService
}]);</code></pre>
</div></div>
</div>