Encapsulate DB.js in angular constants to help testing

This commit is contained in:
Colin McLeod
2015-05-04 21:54:36 -07:00
parent c297bb6e8e
commit bf04a2cc19
8 changed files with 14 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
angular.module('app').controller('OutfitController', ['$rootScope','$scope', '$state', '$stateParams', 'Ship', 'Components', 'Serializer', 'Persist', function ($rootScope, $scope, $state, $p, Ship, Components, Serializer, Persist) {
var data = DB.ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
angular.module('app').controller('OutfitController', ['$rootScope','$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', function ($rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist) {
var data = Ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
var ship = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship instance
// Update the ship instance with the code (if provided) or the 'factory' defaults.