mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
25 lines
501 B
TypeScript
25 lines
501 B
TypeScript
import {IonicView, DeviceMotion} from 'ionic/ionic';
|
|
|
|
|
|
@IonicView({
|
|
template: `
|
|
<ion-navbar *navbar>
|
|
<a menu-toggle>
|
|
<icon menu></icon>
|
|
</a>
|
|
<ion-title>Device Motion</ion-title>
|
|
</ion-navbar>
|
|
<ion-content padding>
|
|
<div *ng-if="accel">{{accel.x}} {{accel.y}} {{accel.z}}</div>
|
|
</ion-content>
|
|
`
|
|
})
|
|
export class DeviceMotionPage {
|
|
constructor() {
|
|
DeviceMotion.watchAcceleration().source.subscribe((accel) => {
|
|
this.accel = accel.acceleration;
|
|
});
|
|
}
|
|
|
|
}
|