title: Angularjs TypeError: undefined is not a function
body: <p>I'm just starting to mess with angular js and I'm trying to load the data through a post action.</p>
  
  <p>I'm using angularjs v.1.0.2</p>
  
  <p>Here is my code:
  HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;meta name="description" content=""&gt;
          &lt;meta name="viewport" content="width=device-width"&gt;
  
          &lt;script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"&gt;&lt;/script&gt;
          &lt;script src="&lt;?php echo $baseUrl?&gt;/js/profilling/main.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div ng-controller="GroupsCtrl"&gt;
  
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>main.js:</p>
  
  <pre><code>function GroupsCtrl($scope, $http) {
      $scope.url = '/file.php';
      $scope.images = [];
  
      function handleGroupsLoaded(data, status) {
          console.log(data);
      }
  
      $scope.fetch = function () {
          $http.post($scope.url).success($scope.handleGroupsLoaded);
      }
  
      $scope.fetch();
  }
  </code></pre>
  
  <p>I'm trying to follow this jsfiddle: <a href="http://jsfiddle.net/simpulton/wHL3F/" rel="noreferrer">http://jsfiddle.net/simpulton/wHL3F/</a></p>
  
  <p>But I'm getting the following error:</p>
  
  <blockquote>
    <p>TypeError: undefined is not a function
        at <a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:92:92" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:92:92</a>
        at i (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:76:119" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:76:119</a>)
        at <a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:76:352" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:76:352</a>
        at Object.e.$eval (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:220" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:220</a>)
        at Object.e.$digest (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:84:198" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:84:198</a>)
        at Object.e.$apply (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:379" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:379</a>)
        at e (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:92:330" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:92:330</a>)
        at o (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:95:407" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:95:407</a>)
        at XMLHttpRequest.q.onreadystatechange (<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:96:334" rel="noreferrer">http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:96:334</a>)</p>
  </blockquote>
  
  <p>Can anyone help?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong>
  file.php:</p>
  
  <pre><code>echo '{"menu": {
    "id": "file",
    "value": "File",
    "popup": {
      "menuitem": [
        {"value": "New", "onclick": "CreateNewDoc()"},
        {"value": "Open", "onclick": "OpenDoc()"},
        {"value": "Close", "onclick": "CloseDoc()"}
      ]
    }
  }}
  ';
  </code></pre>
  
  <p>It seems like a valid json object.</p>