Advertisement
Guest User

Untitled

a guest
Feb 21st, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('app').controller('MootController', ['$scope', '$http', '$rootScope', '$routeParams',
  2.   function($scope, $http, $rootScope, $routeParams) {
  3. $scope.getTotalVotes = function(rullingId, voto_type) {
  4.        
  5.  
  6.         $http({
  7.             url: "/companies/" + $routeParams.companyId + "/moots/" + $routeParams.mootId + '/rullings/' + rullingId + '/totalvotes.json',
  8.             method: "GET",
  9.             params: {vote: voto_type}
  10.          })
  11.         .success(function(result) {
  12.            if (result.total > 0) {
  13.             $scope.totalVotes = result.total;
  14.            } else {
  15.             $scope.totalVotes = 0;
  16.            }          
  17.         })
  18.         .error(function(erro) {
  19.             console.log(erro);
  20.         });
  21.     }
  22. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement