Last active
August 29, 2015 14:00
-
-
Save clouddueling/11189801 to your computer and use it in GitHub Desktop.
A service you can create easily instances of and test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: I ripped this out of my app so it's missing some context. Just observe the methodology used. | |
// This was also incredibly simple to reach 100% testing across the board. | |
(function() { | |
'use strict'; | |
angular.module('module.finder', []) | |
.controller('ModuleFinderCtrl', ['$scope', 'Finder', function($scope, Finder) { | |
$scope.finder = new Finder(); | |
$scope.finder.loadObjects(); | |
$scope.finder.loadTags(); | |
}]) | |
.factory('Finder', ['ObjectService', function(ObjectService) { | |
var Finder = function() { | |
var self = {}; | |
self.filters = { | |
types: [], | |
tags: [], | |
serieIds: [], | |
orderBy: 'updated_at', | |
direction: 'DESC', | |
query: '' | |
}; | |
self.busy = false; | |
self.showTypes = false; | |
self.showTags = false; | |
self.showSeries = false; | |
self.page = 1; | |
self.objects = []; | |
return self; | |
}; | |
return Finder; | |
}]) | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment