Files
Max Lynch fa6c82ff52 Contacts
2015-09-08 14:02:38 -05:00

59 lines
1.4 KiB
TypeScript

import {Component} from 'angular2/angular2';
import {Control, ControlGroup} from 'angular2/forms';
import {App, Http} from 'ionic/ionic';
import {Camera, Geolocation, Vibration, Battery} from 'ionic/ionic';
let testUrl = 'https://ionic-api-tester.herokuapp.com/json';
let testUrl404 = 'https://ionic-api-tester.herokuapp.com/404';
@App({
templateUrl: 'main.html'
})
class IonicApp {
constructor() {
}
doGetLocation() {
console.log('Getting location');
this.gettingLocation = true;
Geolocation.getCurrentPosition().then((pos) => {
this.gettingLocation = false;
console.log('Got location', pos);
this.location = pos;
}, (err) => {
this.gettingLocation = false;
console.error('Unable to get location', err);
});
}
doTrackLocation() {
this.gettingTrackLocation = true;
Geolocation.watchPosition().source.subscribe((pos) => {
this.gettingTrackLocation = false;
console.log('Got location', pos);
this.trackLocation = pos;
}, (err) => {
this.gettingTrackLocation = false;
console.error('Unable to get location', pos);
});
}
getPicture() {
Camera.getPicture({
}).then(data => {
console.log('Data', data);
}, err => {
alert('Unable to take picture')
})
}
doVibrate() {
Vibration.vibrate(1000);
}
doBatteryStatus() {
Battery.getStatus().then((battery) => {
this.battery = battery;
});
}
}