title: AngularJS, Display Json Data With Ng-Repeat and Ng-Factory
body: <p>I am a beginner at Javascript and Angular, and I'm trying to implement AngularJS on my website. I have watching tutorials on CodeSchool, Egghead etc. But I am stack at very beginning.</p>
  
  <p>Getting JSON data from my server and displaying it on my website. Here is my code;</p>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>angular.module('nasuh',[])
  .factory('MY', function($http){
       return  {
            isimler: function() {
            var alHemen;
            var url = 'http://localhost/uzak/remote.php?callback=JSON_CALLBACK';
            $http.get(url).success(function(data) {
            alHemen = data;
            });
            return alHemen;
          }
        };
      })
  .controller('nbgCtrl', function($scope, $http, MY) {
           $scope.mangas = MY.isimler();  
       })
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;html ng-app = "nasuh"&gt;
  &lt;body ng-controller = "nbgCtrl"&gt;
  &lt;div class="col s12 m6 l4" ng-repeat = "manga in mangas"&gt; -----&gt; Want to repeat
          &lt;div class="row"&gt;
          &lt;div class="col s5"&gt;
              &lt;a href="#" class="thumbnail"&gt;
              &lt;img src="/kapaklar/{{manga.kapak}}"&gt;
              &lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="col s7"&gt;
             &lt;p&gt;{{manga.ad}}&lt;/p&gt;
  
             &lt;a href="" class="waves-effect waves-light btn"&gt;&lt;/a&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JSON:</strong></p>
  
  <pre><code> [{"id":"1","ad":"Naruto","yazar":"Masashi KISHIMOTO","kapak":"naruto.jpg"},
   {"id":"2","ad":"One Piece","yazar":"Eiichiro ODA","kapak":"one_piece.jpg"}]
  </code></pre>
  
  <p><strong>Edit-1:</strong> Thank you all for your responses but I think I need calling data at the controller like;</p>
  
  <pre><code>  .factory('MY',
    return {
    isimler: function() {
  </code></pre>
  
  <p>.................................</p>
  
  <pre><code>$scope.mangas=isimler();
  </code></pre>
  
  <p>Because I need to use this data more than once and using it at ui-router extension.</p>
  
  <pre><code>$stateProvider
  .state('icerik', {
    url: "/icerik",
    templateUrl: "icerik.html"
     controller: $scope.mangas = isimler();
  })
  </code></pre>