title: Load data from .json file into factory in Angular
body: <p>I have a factory which loads datas from array, or a selected element from this array. But if I move it to an external .json file, I just get errors - i am newbie to angular in all but trying hard, keep in mind ^^
  So if I use the simple </p>
  
  <pre><code>$http.get('ports.json').success (function(data){
    var works = data;
  });
  </code></pre>
  
  <p>code, I get "ReferenceError: works is not defined". And if I try the</p>
  
  <pre><code>$http.get('ports.json').then((portRes){
      var works = res.data;
  });
  </code></pre>
  
  <p>I get the "Uncaught SyntaxError: Unexpected token {" error. But that code in not a factory, on a whole different page works, so no idea what can be wrong now :/
  Here is the .json filet, and @ the link, you can check the plunker.
  Plunker - <a href="http://plnkr.co/edit/tMrJMjzc4pl7fQ1PIEiO?p=info" rel="nofollow">http://plnkr.co/edit/tMrJMjzc4pl7fQ1PIEiO?p=info</a></p>
  
  <pre><code>[
    {
      "Title": "Sprite",
      "subTitle": "",
      "Link": "sprite",
      "Thumbnail": "img/portfolio02.png",
      "Image": "img/ismont.png"
    },
    {
      "Title": "Pepsi",
      "subTitle": "Kristályvíz",
      "Link": "pepsi",
      "Thumbnail": "img/portfolio03.png",
      "Image": "img/sanofimont.png"
    }
  ]
  </code></pre>
  
  <p>EDIT: So I tried all what u wrote till now but nothing seemd to work... 
  So I have thiw well-working factor now, which I want to transfer to an external .json file, to be very very clear for understand.</p>
  
  <pre><code>  portApp.factory("workFactory", function($http) {  
    var works = [
    {
        Title: "Sprite",
        subTitle: "",
        Link: "sprite",
        Thumbnail: "img/portfolio02.png",
        Image: "img/ismont.png"
    },
    {
        Title: "Pepsi",
        subTitle: "Kristályvíz",
        Link: "pepsi",
        Thumbnail: "img/portfolio03.png",
        Image: "img/sanofimont.png"
    }
    ];
    return {
        list: function() {
            return works;
        },
        selected: function(detPath) {
            selected = works.filter(function(work) {
                return work.Link == detPath;
            });
            return selected;
        }
    };
  </code></pre>