Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit d3b40f3

Browse files
committed
Flashlight in demo
1 parent 56d17a8 commit d3b40f3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

demo/app/www/js/controllers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ angular.module('starter.controllers', [])
1010
{ name: 'Geolocation', slug: 'geolocation' },
1111
{ name: 'Device Motion', slug: 'device-motion' },
1212
{ name: 'Device Orientation', slug: 'device-orientation' },
13+
{ name: 'Flashlight', slug: 'flashlight' },
1314
{ name: 'Statusbar', slug: 'status-bar' },
1415
{ name: 'Vibration', slug: 'vibration' },
1516
{ name: 'Barcode', slug: 'barcode' },
@@ -107,6 +108,15 @@ angular.module('starter.controllers', [])
107108
};
108109
})
109110

111+
.controller('FlashlightCtrl', function($scope, $cordovaFlashlight) {
112+
$scope.on = function() {
113+
$cordovaFlashlight.switchOn();
114+
};
115+
$scope.off = function() {
116+
$cordovaFlashlight.switchOff();
117+
};
118+
})
119+
110120
.controller('VibrationCtrl', function($scope, $cordovaVibration) {
111121
$scope.data = {
112122
vibrateTime: 500
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ion-view title="Flashlight" ng-controller="FlashlightCtrl">
2+
<ion-content scroll="false" padding="true">
3+
<button ng-click="on()" class="button button-energized">On</button>
4+
<button ng-click="off()" class="button button-dark">Off</button>
5+
</ion-content>
6+
</ion-view>

0 commit comments

Comments
 (0)