subscription.js 366 Bytes
angular.module('footyroom')

.controller('SubscriptionController', ['$scope', 'subscription', function ($scope, subscription) {
    $scope.toggle = function () {
        subscription('post', $scope.postId, $scope.isSubscribed ? 'ignore' : 'follow')

        .then(function (response) {
            $scope.isSubscribed = !$scope.isSubscribed;
        });
    };
}]);