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

Commit

Permalink
fix(demo): fix deviceMotion + deviceOrientation
Browse files Browse the repository at this point in the history
  • Loading branch information
pbernasconi committed Oct 30, 2014
1 parent df1a4bf commit 04974dc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 34 deletions.
2 changes: 1 addition & 1 deletion demo/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<author email="hi@ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<content src="http://140.233.211.131:8100" original-src="index.html"/>
<content src="index.html"/>
<access origin="*"/>
<preference name="fullscreen" value="true"/>
<preference name="webviewbounce" value="false"/>
Expand Down
22 changes: 13 additions & 9 deletions demo/www/app/barcodeScanner/barcodeScanner.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<ion-view title="Barcode">

<ion-nav-buttons side="right">
<button class="button button-primary button-clear icon-right ion-code" ng-click="showSource()"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button class="button button-primary button-clear icon-right ion-code" ng-click="showSource()"></button>
</ion-nav-buttons>

<ion-content scroll="false" padding="true">
<button ng-click="scan()" class="button button-block button-primary">Scan</button>
<div ng-bind="scanResult">
</div>
</ion-content>
</ion-view>
<ion-content scroll="false" padding="true">
<button ng-click="scan()" class="button button-block button-primary">Scan</button>
<div class="card">
<div class="item item-divider">Barcode Results</div>
<div class="item">Text: {{scanResult.text}}</div>
<div class="item">Format: {{scanResult.format}}</div>
<div class="item">Cancelled: {{scanResult.cancelled}}</div>
</div>
</ion-content>
</ion-view>
28 changes: 11 additions & 17 deletions demo/www/app/deviceMotion/deviceMotion.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ angular.module('demo.deviceMotion.ctrl', [])
.controller('DeviceMotionCtrl', function ($scope, $cordovaDeviceMotion, $ionicModal) {
var watchID;

$scope.getAcceleration = function () {
$cordovaDeviceMotion
.getCurrentAcceleration()
.then(function (motion) {
$scope.motion = motion;
}, function (err) {
$scope.msg = err.message;
});
};
$cordovaDeviceMotion
.getCurrentAcceleration()
.then(function (motion) {
$scope.motion = motion;
console.log(motion);
}, function (err) {
$scope.msg = err.message;
console.log(err);
});


$scope.watchAcceleration = function () {
var options = { frequency: 3000 }; // Update every 3 seconds
Expand All @@ -31,14 +32,7 @@ angular.module('demo.deviceMotion.ctrl', [])

$scope.clearWatch = function () {
// use watchID from watchAccelaration()

$cordovaDeviceMotion
.clearWatch($scope.this_watch.watchID)
.then(function (result) {
$scope.msg = "watch cleared";
}, function (err) {
$scope.msg = err.message;
});
$cordovaDeviceMotion.clearWatch($scope.this_watch.watchId);
};


Expand Down
9 changes: 2 additions & 7 deletions demo/www/app/deviceOrientation/deviceOrientation.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ angular.module('demo.deviceOrientation.ctrl', [])
};

$scope.clearWatch = function () {
$cordovaDeviceOrientation
.clearWatch($scope.this_watch.watchId)
.then(function (result) {
// Success!
}, function (err) {
// An error occured. Show a message to the user
});
$cordovaDeviceOrientation.clearWatch($scope.this_watch.watchId)

};


Expand Down

0 comments on commit 04974dc

Please sign in to comment.