Removing $rootScope for device and control, not needed anymore.

This commit is contained in:
Gunther Brunner
2014-04-08 20:50:35 +09:00
parent b4e30aae75
commit e10a58c881
11 changed files with 41 additions and 89 deletions

View File

@@ -1,6 +1,6 @@
var _ = require('lodash')
module.exports = function DeviceControlCtrl($scope, $rootScope, DeviceService, GroupService, $location) {
module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService, $location) {
$scope.groupTracker = DeviceService.trackGroup($scope)
@@ -9,14 +9,14 @@ module.exports = function DeviceControlCtrl($scope, $rootScope, DeviceService, G
$scope.kickDevice = function (device) {
// If we're trying to kick current device
if (device.serial === $rootScope.device.serial) {
if (device.serial === $scope.device.serial) {
// If there is more than one device left
if ($scope.groupDevices.length > 1) {
// Control first free device first
var firstFreeDevice = _.find($scope.groupDevices, function (dev) {
return dev.serial !== $rootScope.device.serial
return dev.serial !== $scope.device.serial
})
$scope.controlDevice(firstFreeDevice)
@@ -41,46 +41,4 @@ module.exports = function DeviceControlCtrl($scope, $rootScope, DeviceService, G
$scope.controlDevice = function (device) {
$location.path('/control/' + device.serial)
}
}
// $scope
//, $routeParams
//, $location
//, DeviceService
//, GroupService
//, ControlService
//) {
// $scope.device = null
// $scope.control = null
// $scope.installation = null
//
// $scope.install = function($files) {
// return $scope.control.install($files)
// .then(function(tx) {
// return tx.promise
// .progressed(function(result) {
// $scope.$apply(function() {
// $scope.installation = result
// })
// })
// .then(function(result) {
// $scope.$apply(function() {
// $scope.installation = result
// })
// })
// })
// }
//
// DeviceService.get($routeParams.serial, $scope)
// .then(function(device) {
// return GroupService.invite(device)
// })
// .then(function(device) {
// $scope.device = device
// $scope.control = ControlService.create(device, device.channel)
// return device
// })
// .catch(function() {
// $location.path('/')
// })
//}