mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
Tighten up device
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {IonicView} from 'ionic/ionic';
|
||||
import {IonicView, Device} from 'ionic/ionic';
|
||||
|
||||
|
||||
@IonicView({
|
||||
@ -12,7 +12,8 @@ import {IonicView} from 'ionic/ionic';
|
||||
<ion-content class="padding">
|
||||
<h2>Device</h2>
|
||||
<button primary outline (click)="doDevice()">Get Device</button>
|
||||
<div>
|
||||
<div *ng-if="device">
|
||||
Device name: {{device.name}}
|
||||
</div>
|
||||
</ion-content>
|
||||
`
|
||||
@ -20,7 +21,7 @@ import {IonicView} from 'ionic/ionic';
|
||||
export class DevicePage {
|
||||
|
||||
doDevice() {
|
||||
let device = Device.getDevice();
|
||||
console.log('Got device', device);
|
||||
this.device = Device.getDevice();
|
||||
console.log('Got device', this.device);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,13 @@ export class Device {
|
||||
return this.ifPlugin(window.device, () => {
|
||||
return device;
|
||||
}, () => {
|
||||
return {}
|
||||
return {
|
||||
name: Device.getName(),
|
||||
model: Device.getModel(),
|
||||
platform: Device.getPlatform(),
|
||||
uuid: Device.getUUID(),
|
||||
version: Device.getVersion()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user