title: AngularJs- Failed to instantiate module
body: <p>Before the problem: What we are trying to do is:</p>
  
  <p>I will give a script tag and a piece of javascript to another domain. It will be kind of a widget project. When other site puts my javascript into their website, my javascript will be loaded and inject widget's html. </p>
  
  <p>Widget's html is built with Angular and it's working fine when i directly call that html but it's not working when injected to another page. </p>
  
  <p>Here is some code. </p>
  
  <p>This is how i inject widget's html:</p>
  
  <pre><code>var widget = {
      initialize : function(containerId)
      {
  
          $("#" + containerId).load("widget.html");
  
      }
  }   
  </code></pre>
  
  <p>My widget's html</p>
  
  <pre><code>  &lt;script src="http://localhost:8000/bower_components/angular/angular.js"&gt;&lt;/script&gt;
  &lt;script src="../Controllers/phoneController.js"&gt;&lt;/script&gt;
  
  
  &lt;div ng-app="phonecatApp"&gt;
        &lt;ul ng-controller="PhoneListCtrl"&gt;
      &lt;li ng-repeat="phone in phones"&gt;
        &lt;span&gt;{{phone.name}}&lt;/span&gt;
        &lt;p&gt;{{phone.snippet}}&lt;/p&gt;
        {{2+2}}
      &lt;/li&gt;
    &lt;/ul&gt;
  
  
  &lt;/div&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Aand my controller:</p>
  
  <pre><code>var phonecatApp = angular.module('phonecatApp', []);
  
  phonecatApp.controller('PhoneListCtrl', function ($scope) {
    $scope.phones = [
      {'name': 'Nexus S',
       'snippet': 'Fast just got faster with Nexus S.'},
      {'name': 'Motorola XOOM™ with Wi-Fi',
       'snippet': 'The Next, Next Generation tablet.'},
      {'name': 'MOTOROLA XOOM™',
       'snippet': 'The Next, Next Generation tablet.'}
    ];
  });
  </code></pre>
  
  <p>The exception in the console:</p>
  
  <blockquote>
    <p>Uncaught Error: [$injector:modulerr] Failed to instantiate module
    phonecatApp due to: Error: [$injector:nomod] Module 'phonecatApp' is
    not available! You either misspelled the module name or forgot to load
    it. If registering a module ensure that you specify the dependencies
    as the second argument.</p>
  </blockquote>
  
  <p>Edit: There is {{2+2}} code in my html, just to test Angular. It's not evaluated by Angular and printed into html as it is.</p>