switched to angular-resource instead of using $http