title: Convert a controller into a component
body: <p>How do I convert a controller into a component and then include it in another component as a dependency? </p>
  
  <p>I would like to do this in order to be able to use certain functions which are in this controller in a component, which has an isolated scope.</p>
  
  <p>My controller:
  </p>
  
  <pre><code>angular
  .module('myApp')
  .controller('TaxiesController', ['$scope', '$http', '$location', '$routeParams', '$route', 'dataFactory', '$interval', function($scope, $http, $location, $routeParams, $route, dataFactory, $interval){
      console.log('TaxiesController loaded')
      var cancel = {name: 'Preklic', price: 500}
      $scope.taxies = [];
      $scope.taxi = {};
      $scope.taxi.history = [];
  
      $scope.getTaxies = () =&gt; {
          //console.log('X')
          dataFactory.getTaxies().then(function(response){ //make a get req from this address
              $scope.taxies = response.data; 
          });
      }
  
      $scope.getTaxi = () =&gt; {
          var id = $routeParams.id;
          dataFactory.getTaxi(id).then(function(response){ 
              $scope.taxi = response.data; //to moram uporabit, da dobim taxi
          });
      }
  
      $scope.removeTaxi = (id) =&gt; {
          dataFactory.removeTaxi(id).then(function(response){ 
              //window.location.href='#!'; 
          });
      }
  
      $scope.getTotal = (taxi) =&gt; {
          var total = 0;
          for(var i = 0; i &lt; taxi.history.length; i++){ // deluje tudi z $scope.taxi.history.length
              var rent = taxi.history[i];
              if(rent.price) total += rent.price;
          }
          return total;
      }
  
      $scope.cancelTaxi = (taxi, id) =&gt; {
          console.log('cancelling..')
          taxi.available = true;
          taxi.history.unshift(cancel);
          dataFactory.updateTaxi(id, taxi).then(function(response){ 
          });
      }
  
  
  }]);
  </code></pre>