title: AngularJS Controller Error - TypeError: undefined is not a function
body: <p>I am trying to load data from json. But my code is error. How can I fix it?</p>
  
  <p><strong>error message</strong></p>
  
  <pre><code>TypeError: undefined is not a function
      at new &lt;anonymous&gt; (http://s.codepen.io/boomerang/f0c70f5befd13788970cee6187a271461412729151639/index.html:66:15)
      at invoke (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:12639:17)
      at Object.instantiate (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:12650:23)
      at http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:15709:28
      at http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:15118:34
      at forEach (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:9239:20)
      at nodeLinkFn (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:15105:11)
      at compositeLinkFn (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:14569:15)
      at compositeLinkFn (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:14572:13)
      at publicLinkFn (http://code.ionicframework.com/1.0.0-beta.6/js/ionic.bundle.js:14474:30) 
  </code></pre>
  
  <p><strong>JS file</strong></p>
  
  <pre><code>angular.module('ionicApp', ['ionic'])
  
  .factory('JsonService', function($http) {
  
    var url="http://www.garsoncepte.com/json.php?callback=JSON_CALLBACK";
  
    var getData = function(successFn, errorFn){
      $http.get('url')
      .success(successFn)
      .error(errorFn);
    };
  
    return getData;
   })
  
  .controller('MyCtrl', function($scope, JsonService) {
    JsonService.getData(function(data){ //It may be error code
      $scope.items = data;
    },function(error){});
  
  });
  </code></pre>
  
  <p>I use this : <a href="http://codepen.io/m_abdelfattah/pen/Gkiju" rel="nofollow">http://codepen.io/m_abdelfattah/pen/Gkiju</a></p>