title: AngularJS: Uncaught Error: [$injector:modulerr] Failed to instantiate module?
body: <p>I am new to AngularJS and working my way through some documents and tutorials to learn. My question is in reference to Egghead's video series, this video in particular, demonstrating how to put together a basic search filter.  I wanted to use this in a real app I'm building for a friend with a small candle-making business but when I modified it to be her candles rather than the Avengers cast (as demo'd in the video) I got this error:</p>
  <blockquote>
  <p><em>Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:</em></p>
  <p><em>Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify ...</em></p>
  </blockquote>
  <p>I copied a redacted (only 3 cast members in the array) version of EXACTLY what is in the video demo into a jsfiddle and discovered it still yields the same error.  (For reference, the Egghead demo is here: <a href="http://www.thinkster.io/angularjs/ET1iee6rnm/angularjs-ngfilter" rel="noreferrer">http://www.thinkster.io/angularjs/ET1iee6rnm/angularjs-ngfilter</a>).  I've read at least a half dozen similar questions on this site so far and tried every solution offered, but none of them get rid of this error or cause the Avengers search -- which works fine in the video demo -- to actually function properly.</p>
  <p>HTML:</p>
  <pre><code>&lt;div ng-app=&quot;myApp&quot;&gt;
      &lt;div ng-controller=&quot;AvengersCtrl&quot;&gt;
          &lt;input type=&quot;text&quot; ng-model=&quot;search.$&quot; /&gt;
          &lt;table&gt;
              &lt;tr ng-repeat=&quot;actor in avengers.cast | filter:search&quot;&gt;
                  &lt;td&gt;{{actor.name}}&lt;/td&gt;
                  &lt;td&gt;{{actor.character}}&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Javascript:</p>
  <pre><code>var myApp = angular.module('myApp', []);
  myApp.factory('Avengers', function () {
      var Avengers = {};
      Avengers.cast = [
          {
          name: &quot;Robert Downey Jr.&quot;,
          character: &quot;Tony Stark / Iron Man&quot;
          }, 
          {
          name: &quot;Chris Evans&quot;,
          character: &quot;Steve Rogers / Captain America&quot;
          },
          {
          name: &quot;Mark Buffalo&quot;,
          character: &quot;Bruce Banner / The Hulk&quot;
          }
      ];
      return Avengers;
  })
  
  function AvengersCtrl($scope, Avengers) {
      $scope.avengers = Avengers;
  }
  </code></pre>
  <p>Simply put, can someone offer a solution that will work and get rid of this error, as well as explain in simple English (not Ph.D. level &quot;Angular Obscurese&quot;) what causes it (in a nutshell) and what needs to be done to avoid it?</p>
  <p>Edit: Apologies, but the jsfiddle link referenced above from the tutorial is no longer active. I have removed the broken link. The tutorial mentioned is still available for viewing.</p>