title: Services in Angular
body: <p>I'm quite new with Angular and I am trying to bring some structure in my website I am building with Angular. </p>
  
  <p>Now I have a Controller where I have some functions which I use on multiple pages. I have heard that I could better make a service out of these functions. How am I able to do this?</p>
  
  <p>This is my Controller in current state:
  How can I make a service from $scope.city function and $scope.specials function?</p>
  
  <pre><code>app.controller('DataCtrl', function($scope,$http){
    $scope.city = function(){
      $scope.items = [];
  
      $http.get('/getdata').then(function(d){
        $scope.items = d.data;
        $scope.selectedItem = $scope.items[0];
      },function(err){
        console.log(err);
      });
    };
  
    /* Function for specialization data */
    $scope.specials = function(){
      $scope.special = [];
  
      $http.get('/specialdata').then(function(d){
        $scope.special = d.data[0];
      },function(err){
        console.log(err);
      });
    };
  });
  </code></pre>