Files
stf-DeviceFarmer/res/app/control-panes/automation/device-settings/device-settings-controller.js
Gunther Brunner 743f8becd6 - Finally, most of the unit tests now passes (resolving dependencies also).
- Shims now exports angular module name, however some of them clash with the original.
2014-08-21 22:04:19 +09:00

24 lines
585 B
JavaScript

module.exports = function DeviceSettingsCtrl($scope, $timeout) {
$scope.wifiEnabled = true
var getWifiStatus = function () {
if ($scope.control) {
$scope.control.getWifiStatus().then(function (result) {
$scope.$apply(function () {
$scope.wifiEnabled = (result.lastData === 'wifi_enabled')
})
})
}
}
getWifiStatus()
$scope.toggleWifi = function () {
if ($scope.control) {
$scope.control.setWifiEnabled(!$scope.wifiEnabled)
$scope.wifiEnabled = !$scope.wifiEnabled
$timeout(getWifiStatus, 500)
}
}
}