text: Q:
  
  What method should be attached to $scope?
  
  I am new to AngularJS, and have WPF MVVM experience before. Now, I'm very confused with $scope, it looks like it is a viewmodel, we can define functions on it and use ng-change, ng-click or some other angular directives to connect the functions. But if the function is not related to UI, should we also attach them to $scope? What types of functions should we define on $scope? I also read some articles which suggest using services to encapsulate the real implementation and just call the service in $scope's methods, this can decoupling some http call. But I think it will created too much services, and some of the services will not be reused. Any ideas?
  
  A:
  
  In $scope you bind methods and fields those should be available using $scope.$eval() or $scope.$apply() (those methods using implicity when you use interpolation: {{itIsInterpolation}} or ng- prefixed attributes in your html code). 
  So you can think about $scope methods, like:
  Methods those can be invoked from the HTML layer and nothing more.
  But by MVC ideology you using controller just to ask service layer to perform some logical action and then return (render and put into $scope) some result. Here the same. For example: 
  
  angular
    .module('myApp', [])
    .factory('ItemService', ItemService)
    .controller('ItemController', ItemController);
  
  function ItemService($http) {
    return {
      getAllItemCost: getAllItemCost 
    };
    
    function getAllItemCost() {
      return $http.get('api/items)
        .then(function (response) {
          var items = response.data;
          return items.map(item => item.price).reduce((a, b) => a + b);
        });
    }
  }
  
  function ItemController(ItemService) {
    $scope.itemsCost = 0;
    
    $scope.updateItemsCost = function () {
      ItemService.getAllItemCost()
        .then(function (cost) {
          $scope.itemsCost = cost;
        });
    }
  }
  
  