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

Commit 0753ec3

Browse files
committed
Side menu
1 parent 41f33f0 commit 0753ec3

File tree

9 files changed

+34
-6
lines changed

9 files changed

+34
-6
lines changed

demo/app/init.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function ap {
44
cordova plugin add org.apache.cordova.$1
55
}
66

7+
ap console
78
ap device
89
ap camera
910
ap vibration

demo/app/www/js/controllers.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ angular.module('starter.controllers', [])
77
.controller('AppCtrl', function($scope) {
88
$scope.plugins = [
99
{ name: 'Camera', slug: 'camera' },
10-
{ name: 'Geolocation', slug: 'geolocation' }
10+
{ name: 'Geolocation', slug: 'geolocation' },
11+
{ name: 'Accelerometer', slug: 'accelerometer' }
1112
];
1213
})
1314

@@ -38,4 +39,18 @@ angular.module('starter.controllers', [])
3839
$scope.lng = position.coords.longitude;
3940
});
4041
};
42+
})
43+
44+
.controller('AccelCtrl', function($scope, $cordovaAccelerometer) {
45+
console.log('Accel');
46+
$scope.toggleTrack = function() {
47+
$cordovaAccelerometer.watchAcceleration().then(function(resp) {
48+
}, function(err) {
49+
}, function(data) {
50+
console.log('Data', data)
51+
$scope.x = data.x;
52+
$scope.y = data.y;
53+
$scope.z = data.z;
54+
});
55+
};
4156
});

demo/app/www/lib/ngCordova/ng-cordova.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ angular.module('ngCordova.plugins.accelerometer', [])
3131

3232
navigator.accelerometer.watchAcceleration(function(result) {
3333
// Do any magic you need
34-
q.resolve(result);
34+
q.notify(result);
3535
}, function(err) {
3636
q.reject(err);
3737
}, options);

demo/app/www/lib/ngCordova/ng-cordova.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<ion-view title="Accelerometer" ng-controller="AccelCtrl">
2+
<ion-content padding="true">
3+
<button class="button button-dark" ng-click="toggleTrack()">Toggle Track</button>
4+
<br>
5+
x: {{x}}
6+
<br>
7+
y: {{y}}
8+
<br>
9+
z: {{z}}
10+
</ion-content>
11+
</ion-view>

demo/app/www/templates/plugins/geolocation.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ion-view title="Geolocation" ng-controller="GeolocationCtrl">
22
<ion-content padding="true">
33
<button class="button button-dark" ng-click="toggleTrack()">Toggle Track</button>
4+
<br>
45
lat: {{lat}}
56
lng: {{lng}}
67
</ion-content>

dist/ng-cordova.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ angular.module('ngCordova.plugins.accelerometer', [])
3131

3232
navigator.accelerometer.watchAcceleration(function(result) {
3333
// Do any magic you need
34-
q.resolve(result);
34+
q.notify(result);
3535
}, function(err) {
3636
q.reject(err);
3737
}, options);

0 commit comments

Comments
 (0)