Neues Initialrelease mit IonicMaterial

This commit is contained in:
Carsten Hilmer
2016-08-22 12:55:52 +02:00
parent 30a5df79aa
commit 45e482b14d
1249 changed files with 305225 additions and 68794 deletions

0
www/lib/ngCordova/demo/www/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,32 @@
This is an addon starter template for the [Ionic Framework](http://ionicframework.com/).
## How to use this template
*This template does not work on its own*. It is missing the Ionic library, and AngularJS.
To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately.
### With the Ionic tool:
Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below:
```bash
$ sudo npm install -g ionic cordova
$ ionic start myApp blank
```
Then, to run it, cd into `myApp` and run:
```bash
$ ionic platform add ios
$ ionic build ios
$ ionic emulate ios
```
Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android.
## Demo
http://plnkr.co/edit/tpl:IUU30p?p=preview
## Issues
Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here!

View File

@@ -0,0 +1,8 @@
<ion-view title="About">
<ion-content padding="true">
<h1>ABOUT</h1>
<p>This is a demo application for <a href="http://ngcordova.com">ngCordova</a>.</p>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.adMob.ctrl', [])
.controller('AdMobCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="adMob">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,378 @@
angular.module('demo', [
'ionic',
'ngCordova',
// modules
// 'demo.adMob.ctrl', -- not functioning right now
'demo.appAvailability.ctrl',
'demo.appRate.ctrl',
'demo.barcodeScanner.ctrl',
'demo.batteryStatus.ctrl',
'demo.beacon.ctrl',
'demo.camera.ctrl',
'demo.clipboard.ctrl',
'demo.contacts.ctrl',
'demo.datePicker.ctrl',
'demo.device.ctrl',
'demo.deviceMotion.ctrl',
'demo.deviceOrientation.ctrl',
'demo.dialogs.ctrl',
'demo.emailComposer.ctrl',
'demo.facebook.ctrl',
'demo.file.ctrl',
'demo.fileOpener2.ctrl',
'demo.fileTransfer.ctrl',
'demo.flashlight.ctrl',
'demo.geolocation.ctrl',
'demo.globalization.ctrl',
'demo.googleAnalytics.ctrl',
'demo.healthkit.ctrl',
'demo.inAppBrowser.ctrl',
'demo.localNotification.ctrl',
'demo.media.ctrl',
'demo.network.ctrl',
'demo.oauth.ctrl',
'demo.preferences.ctrl',
'demo.printer.ctrl',
'demo.pushNotifications.ctrl',
'demo.socialSharing.ctrl',
'demo.sqlite.ctrl',
'demo.statusbar.ctrl',
'demo.toast.ctrl',
'demo.touchid.ctrl',
'demo.vibration.ctrl',
'demo.upsPushNotifications.ctrl'
])
.run(function ($rootScope, $ionicPlatform, $cordovaNetwork, $cordovaBatteryStatus, $cordovaLocalNotification, $cordovaPush) {
$ionicPlatform.ready(function () {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
$cordovaLocalNotification.registerPermission().then(function () {
//alert("registered");
}, function () {
//alert("denied registration");
});
var iosConfig = {
"badge": true,
"sound": true,
"alert": true
};
$cordovaPush.register(iosConfig).then(function (result) {
//alert("device token: " + result.deviceToken);
}, function (error) {
//alert("error " + error);
});
$rootScope.$on('$cordovaPush:notificationReceived', function (event, notification) {
if (notification.alert) {
navigator.notification.alert(notification.alert);
}
if (notification.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (notification.badge) {
$cordovaPush.setBadgeNumber(notification.badge).then(function (result) {
// Success!
}, function (err) {
// An error occurred. Show a message to the user
});
}
});
$rootScope.$on("$cordovaNetwork:offline", function (event, result) {
alert("Device is now Offline!");
});
$rootScope.$on("$cordovaNetwork:online", function (event, result) {
alert("Device is Online!");
});
$rootScope.$on("$cordovaBatteryStatus:status", function (event, status) {
//alert("status: " + status);
})
})
})
.config(function ($stateProvider, $urlRouterProvider, $cordovaFacebookProvider, $cordovaAppRateProvider, $cordovaInAppBrowserProvider) {
if (!window.cordova) {
var appID = 1234567890;
var version = "v2.0"; // or leave blank and default is v2.0
//$cordovaFacebookProvider.browserInit(appID, version);
}
var browserOptions = {
location: "yes",
toolbar: "yes"
};
document.addEventListener("deviceready", function () {
var preferences = {
iosURL: "some URL",
appName: 'APP NAME',
language: 'fr'
};
$cordovaAppRateProvider.setPreferences(preferences);
}, false);
$cordovaInAppBrowserProvider.setDefaultOptions(browserOptions);
$stateProvider
.state('menu', {
url: "/menu",
templateUrl: "app/menu.html"
})
.state('about', {
url: "/about",
templateUrl: "app/about.html"
})
.state('appAvailability', {
url: '/appAvailability',
templateUrl: 'app/appAvailability/appAvailability.html',
controller: "AppAvailabilityCtrl"
})
.state('appRate', {
url: '/appRate',
templateUrl: 'app/appRate/appRate.html',
controller: "AppRateCtrl"
})
.state('barcodeScanner', {
url: '/barcodeScanner',
templateUrl: 'app/barcodeScanner/barcodeScanner.html',
controller: "BarcodeScannerCtrl"
})
.state('batteryStatus', {
url: '/batteryStatus',
templateUrl: 'app/batteryStatus/batteryStatus.html',
controller: "BatteryStatusCtrl"
})
.state('beacon', {
url: '/beacon',
templateUrl: 'app/beacon/beacon.html',
controller: "BeaconCtrl"
})
.state('camera', {
url: '/camera',
templateUrl: 'app/camera/camera.html',
controller: "CameraCtrl"
})
.state('clipboard', {
url: '/clipboard',
templateUrl: 'app/clipboard/clipboard.html',
controller: "ClipboardCtrl"
})
.state('contacts', {
url: '/contacts',
templateUrl: 'app/contacts/contacts.html',
controller: "ContactsCtrl"
})
.state('datePicker', {
url: '/datePicker',
templateUrl: 'app/datePicker/datePicker.html',
controller: "DatePickerCtrl"
})
.state('device', {
url: '/device',
templateUrl: 'app/device/device.html',
controller: "DeviceCtrl"
})
.state('deviceMotion', {
url: '/deviceMotion',
templateUrl: 'app/deviceMotion/deviceMotion.html',
controller: "DeviceMotionCtrl"
})
.state('deviceOrientation', {
url: '/deviceOrientation',
templateUrl: 'app/deviceOrientation/deviceOrientation.html',
controller: "DeviceOrientationCtrl"
})
.state('dialogs', {
url: '/dialogs',
templateUrl: 'app/dialogs/dialogs.html',
controller: "DialogsCtrl"
})
.state('emailComposer', {
url: '/emailComposer',
templateUrl: 'app/emailComposer/emailComposer.html',
controller: "EmailComposerCtrl"
})
.state('facebook', {
url: '/facebook',
templateUrl: 'app/facebook/facebook.html',
controller: "FacebookCtrl"
})
.state('file', {
url: '/file',
templateUrl: 'app/file/file.html',
controller: "FileCtrl"
})
.state('fileTransfer', {
url: '/fileTransfer',
templateUrl: 'app/fileTransfer/fileTransfer.html',
controller: "FileTransferCtrl"
})
.state('fileOpener2', {
url: '/fileOpener2',
templateUrl: 'app/fileOpener2/fileOpener2.html',
controller: "FileOpener2Ctrl"
})
.state('flashlight', {
url: '/flashlight',
templateUrl: 'app/flashlight/flashlight.html',
controller: "FlashlightCtrl"
})
.state('geolocation', {
url: '/geolocation',
templateUrl: 'app/geolocation/geolocation.html',
controller: "GeolocationCtrl"
})
.state('globalization', {
url: '/global',
templateUrl: 'app/globalization/globalization.html',
controller: "GlobalizationCtrl"
})
.state('googleAnalytics', {
url: '/googleAnalytics',
templateUrl: 'app/googleAnalytics/googleAnalytics.html',
controller: "GoogleAnalyticsCtrl"
})
.state('healthkit', {
url: '/healthkit',
templateUrl: 'app/healthkit/healthkit.html',
controller: "HealthKitCtrl"
})
.state('inAppBrowser', {
url: '/inAppBrowser',
templateUrl: 'app/inAppBrowser/inAppBrowser.html',
controller: "InAppBrowserCtrl"
})
.state('localNotification', {
url: '/localNotification',
templateUrl: 'app/localNotification/localNotification.html',
controller: "LocalNotificationCtrl"
})
.state('media', {
url: '/media',
templateUrl: 'app/media/media.html',
controller: "MediaCtrl"
})
.state('network', {
url: '/network',
templateUrl: 'app/network/network.html',
controller: "NetworkCtrl"
})
.state('oauth', {
url: '/oauth',
templateUrl: 'app/oauth/oauth.html',
controller: "OauthCtrl"
})
.state('preferences', {
url: '/preferences',
templateUrl: 'app/preferences/preferences.html',
controller: "PreferencesCtrl"
})
.state('printer', {
url: '/printer',
templateUrl: 'app/printer/printer.html',
controller: "PrinterCtrl"
})
.state('pushNotifications', {
url: '/pushNotifications',
templateUrl: 'app/pushNotifications/pushNotifications.html',
controller: "PushNotificationsCtrl"
})
.state('socialSharing', {
url: '/socialSharing',
templateUrl: 'app/socialSharing/socialSharing.html',
controller: "SocialSharingCtrl"
})
.state('sqlite', {
url: '/sqlite',
templateUrl: 'app/sqlite/sqlite.html',
controller: "SqliteCtrl"
})
.state('statusbar', {
url: '/statusbar',
templateUrl: 'app/statusbar/statusbar.html',
controller: "StatusbarCtrl"
})
.state('toast', {
url: '/toast',
templateUrl: 'app/toast/toast.html',
controller: "ToastCtrl"
})
.state('touchid', {
url: '/touchid',
templateUrl: 'app/touchid/touchid.html',
controller: "TouchIDCtrl"
})
.state('vibration', {
url: '/vibration',
templateUrl: 'app/vibration/vibration.html',
controller: "VibrationCtrl"
})
.state('upsPushNotifications', {
url: '/upsPushNotifications',
templateUrl: 'app/upsPushNotifications/pushNotifications.html',
controller: "UpsPushNotificationsCtrl"
});
$urlRouterProvider.otherwise('/menu');
});

View File

@@ -0,0 +1,5 @@
angular.module('demo.appAvailability.ctrl', [])
.controller('AppAvailabilityCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="appAvailability">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,12 @@
angular.module('demo.appRate.ctrl', [])
.controller('AppRateCtrl', function ($scope, $log, $cordovaAppRate) {
$scope.promptRating = function () {
$cordovaAppRate.promptForRating(true).then(function (result) {
console.log("result: " + result);
}, function (error) {
console.log("ERROR: " + error);
})
};
});

View File

@@ -0,0 +1,15 @@
<ion-view title="App Rate">
<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>
<div class="card">
<div class="item">
<button class="button button-block button-positive" ng-click="promptRating()">
Show rating reminder
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,15 @@
angular.module('demo.barcodeScanner.ctrl', [])
.controller('BarcodeScannerCtrl', function ($scope, $cordovaBarcodeScanner) {
$scope.scan = function () {
$cordovaBarcodeScanner
.scan()
.then(function (result) {
$scope.scanResult = result;
}, function (err) {
$scope.scanResult = 'SCAN ERROR (see console)';
console.error(err);
});
};
});

View File

@@ -0,0 +1,12 @@
<ion-view title="Barcode">
<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>

View File

@@ -0,0 +1,32 @@
angular.module('demo.batteryStatus.ctrl', [])
.controller('BatteryStatusCtrl', function ($scope, $timeout, $cordovaBatteryStatus) {
console.log("battery status init");
document.addEventListener("deviceready", function () {
$scope.watch = function () {
console.log("watching battery");
$cordovaBatteryStatus.$on('batterystatus', function (result, info) {
$timeout(function () {
$scope.batteryLevel = info.level; // (0 - 100)
$scope.isPluggedIn = info.isPlugged; // bool
});
alert("Info " + info.level + " " + info.isPlugged);
});
};
}, false);
/*
$cordovaBatteryStatus.$on('batterycritical', function (result) {
$scope.batteryLevel = result.level; // (0 - 100)
$scope.isPluggedIn = result.isPlugged; // bool
});
$cordovaBatteryStatus.$on('batterylow', function (result) {
$scope.batteryLevel = result.level; // (0 - 100)
$scope.isPluggedIn = result.isPlugged; // bool
});
*/
});

View File

@@ -0,0 +1,23 @@
<ion-view title="Battery Status">
<ion-content scroll="false" padding="true">
<button ng-click="watch()" class="button button-block button-primary">Start Watch</button>
<div class="card">
<div class="item item-divider">
Battery Level
</div>
<div class="item item-body">
{{batteryLevel}}
</div>
</div>
<div class="card">
<div class="item item-divider">
is Plugged in
</div>
<div class="item item-body">
{{isPluggedIn}}
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,63 @@
angular.module('demo.beacon.ctrl', [])
.controller('BeaconCtrl', function($window, $scope, $rootScope, $timeout, $cordovaBeacon) {
var brIdentifier = 'estimote';
var brUuid = 'b9407f30-f5f8-466e-aff9-25556b57fe6d';
var brMajor = null;
var brMinor = null;
var brNotifyEntryStateOnDisplay = true;
$scope.didStartMonitoringForRegionLog = '';
$scope.didDetermineStateForRegionLog = '';
$scope.didRangeBeaconsInRegionLog = '';
$scope.requestAlwaysAuthorization = function() {
$cordovaBeacon.requestAlwaysAuthorization();
};
$scope.startMonitoringForRegion = function() {
$cordovaBeacon.startMonitoringForRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.startRangingBeaconsInRegion = function() {
$cordovaBeacon.startRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.stopMonitoringForRegion = function() {
$cordovaBeacon.stopMonitoringForRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.stopRangingBeaconsInRegion = function() {
$cordovaBeacon.stopRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.clearLogs = function() {
$scope.didStartMonitoringForRegionLog = '';
$scope.didDetermineStateForRegionLog = '';
$scope.didRangeBeaconsInRegionLog = '';
};
document.addEventListener("deviceready", function () {
$rootScope.$on("$cordovaBeacon:didStartMonitoringForRegion", function (event, pluginResult) {
$scope.didStartMonitoringForRegionLog += '-----' + '\n';
$scope.didStartMonitoringForRegionLog += JSON.stringify(pluginResult) + '\n';
});
$rootScope.$on("$cordovaBeacon:didDetermineStateForRegion", function (event, pluginResult) {
$scope.didDetermineStateForRegionLog += '-----' + '\n';
$scope.didDetermineStateForRegionLog += JSON.stringify(pluginResult) + '\n';
});
$rootScope.$on("$cordovaBeacon:didRangeBeaconsInRegion", function (event, pluginResult) {
$scope.didRangeBeaconsInRegionLog += '-----' + '\n';
$scope.didRangeBeaconsInRegionLog += JSON.stringify(pluginResult) + '\n';
});
}, false);
});

View File

@@ -0,0 +1,46 @@
<ion-view title="Beacon">
<ion-content padding="false" has-bouncing="false">
<div class="list card">
<div class="item item-text-wrap">
<button class="button button-block button-stable" ng-click="clearLogs()">
Clear logs
</button>
</div>
<div class="item item-text-wrap">
<strong>Permission</strong>
<button class="button button-block button-stable" ng-click="requestAlwaysAuthorization()">
Request Always Authorization (iOS only)
</button>
</div>
<div class="item item-text-wrap">
<strong>Start</strong>
<button class="button button-block button-stable" ng-click="startMonitoringForRegion()">
Start Monitoring for region
</button>
<button class="button button-block button-stable" ng-click="startRangingBeaconsInRegion()">
Start Ranging beacons in region
</button>
</div>
<div class="item item-text-wrap">
<strong>Stop</strong>
<button class="button button-block button-stable" ng-click="stopMonitoringForRegion()">
Stop Monitoring for region
</button>
<button class="button button-block button-stable" ng-click="stopRangingBeaconsInRegion()">
Stop Ranging beacons in region
</button>
</div>
<div class="item item-divider item-text-wrap">
Events
</div>
<div class="item item-text-wrap">
<strong>didStartMonitoringForRegion</strong><br />
<pre>{{didStartMonitoringForRegionLog}}</pre>
<strong>didDetermineStateForRegion</strong><br />
<pre>{{didDetermineStateForRegionLog}}</pre>
<strong>didRangeBeaconsInRegion</strong><br />
<pre>{{didRangeBeaconsInRegionLog}}</pre>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,19 @@
angular.module('demo.camera.ctrl', [])
.controller('CameraCtrl', function ($scope, $cordovaCamera) {
$scope.takePicture = function () {
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA
};
// udpate camera image directive
$cordovaCamera.getPicture(options).then(function (imageData) {
$scope.cameraimage = "data:image/jpeg;base64," + imageData;
}, function (err) {
console.log('Failed because: ');
console.log(err);
});
};
});

View File

@@ -0,0 +1,21 @@
<ion-view title="Camera">
<ion-content>
<div class="card">
<div class="item item-divider">
Take a picture
</div>
<div class="item item-image">
<img class="item" ng-src="{{cameraimage}}" style="height: 350px;"/>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="takePicture()">
Take Photo
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.clipboard.ctrl', [])
.controller('ClipboardCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,30 @@
<ion-view title="Clipboard">
<ion-content>
<div class="card">
<div class="item">
<p>This is some text to be copied</p>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="copy()">
Copy!
</button>
</div>
<div class="list">
<label class="item item-input">
<input type="text"
ng-model="data.value"
placeholder="Paste the text here">
</label>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="copy()">
Paste!
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,31 @@
angular.module('demo.contacts.ctrl', [])
.controller('ContactsCtrl', function ($scope, $log, $cordovaContacts) {
$scope.pickContact = function () {
document.addEventListener("deviceready", function () {
$cordovaContacts.pickContact().then(function (result) {
console.log(JSON.stringify(result));
$scope.selectedContact = result;
})
}, false);
};
$scope.saveContact = function (contact) {
document.addEventListener("deviceready", function () {
$cordovaContacts.save(contact).then(function (result) {
console.log(JSON.stringify(result));
})
}, false);
};
$scope.removeContact = function (contact) {
document.addEventListener("deviceready", function () {
$cordovaContacts.remove(contact).then(function (result) {
console.log(JSON.stringify(result));
})
}, false);
};
});

View File

@@ -0,0 +1,53 @@
<!--
- save(contact)
- remove(contact)
- clone(contact)
- find(options)
-->
<ion-view title="Contacts">
<ion-content>
<div class="padding-horizontal">
<button class="button button-block button-balanced" ng-click="pickContact()">
Pick a Contact from Phone
</button>
</div>
<div class="card" ng-if="selectedContact != undefined">
<div class="item">
<h3>NAME: {{selectedContact.name.givenName}} {{selectedContact.name.familyName}}</h3>
</div>
</div>
<div class="list">
<label class="item item-input item-floating-label">
<span class="input-label">Create new Contact</span>
<input type="text" placeholder="Create new Contact" ng-model="newContact">
</label>
</div>
<div class="padding-horizontal">
<button class="button button-block button-positive" ng-click="saveContact(newContact)">
Create new Contact
</button>
</div>
<br>
<div class="list">
<label class="item item-input item-floating-label">
<span class="input-label">Remove a Contact</span>
<input type="text" placeholder="Remove a Contact" ng-model="oldContact">
</label>
</div>
<div class="padding-horizontal">
<button class="button button-block button-assertive" ng-click="removeContact(contact)">
Remove Contact
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,27 @@
angular.module('demo.datePicker.ctrl', [])
.controller('DatePickerCtrl', function ($scope, $cordovaDatePicker) {
var options,
dateType,
msg = 'not picked yet',
handleDatePicker = function (date) {
$scope.data[dateType] = date;
$scope.$apply();
};
$scope.data = {
date: msg,
time: msg
};
$scope.pick = function (type) {
options = {
date: new Date(),
mode: type
};
dateType = type;
$cordovaDatePicker.show(options, handleDatePicker);
};
});

View File

@@ -0,0 +1,26 @@
<ion-view title="Date picker">
<ion-content>
<div class="list">
<div class="item">
{{ data.date }} <br>
<button class="button button-block button-positive"
ng-click="pick('date')">pick date</button>
</div>
<div class="item">
{{ data.time }} <br>
<button class="button button-block button-positive"
ng-click="pick('time')">pick time</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,24 @@
angular.module('demo.device.ctrl', [])
.controller('DeviceCtrl', function ($scope, $state, $cordovaDevice) {
var init = function () {
console.log("initializing device");
try {
document.addEventListener("deviceready", function () {
$scope.available = $cordovaDevice.getDevice().available;
$scope.cordova = $cordovaDevice.getCordova();
$scope.model = $cordovaDevice.getModel();
$scope.platform = $cordovaDevice.getPlatform();
$scope.uuid = $cordovaDevice.getUUID();
$scope.version = $cordovaDevice.getVersion();
}, false);
}
catch (err) {
console.log("Error " + err.message);
alert("error " + err.$$failure.message);
}
};
init();
});

View File

@@ -0,0 +1,38 @@
<ion-view title="Device Info">
<ion-content>
<div class="list card">
<div class="item item-text-wrap">
<h2>Available</h2>
<p>{{available}}</p>
</div>
<div class="item item-text-wrap">
<h2>Model</h2>
<p>{{model}}</p>
</div>
<div class="item item-text-wrap">
<h2>Platform</h2>
<p>{{platform}}</p>
</div>
<div class="item item-text-wrap">
<h2>Version</h2>
<p>{{version}}</p>
</div>
<div class="item item-text-wrap">
<h2>UUID</h2>
<p>{{uuid}}</p>
</div>
<div class="item item-text-wrap">
<h2>Cordova Version</h2>
<p>{{cordova}}</p>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,38 @@
angular.module('demo.deviceMotion.ctrl', [])
.controller('DeviceMotionCtrl', function ($scope, $cordovaDeviceMotion) {
var watchID;
$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
$scope.this_watch = $cordovaDeviceMotion.watchAcceleration(options);
$scope.this_watch.promise.then(
function () { /* unused */
},
function (err) {
$scope.msg = err.message;
},
function (motion) {
$scope.motion = motion;
});
};
$scope.clearWatch = function () {
// use watchID from watchAccelaration()
$cordovaDeviceMotion.clearWatch($scope.this_watch.watchId);
};
});

View File

@@ -0,0 +1,43 @@
<ion-view title="Device Motion">
<ion-content>
<div class="card">
<div class="item item-divider">
Acceleration
</div>
<div class="item item-text-wrap" ng-show="msg">
{{msg}}
</div>
<div class="item">
<strong>X</strong> &nbsp {{motion.x}}
</div>
<div class="item">
<strong>Y</strong> &nbsp {{motion.y}}
</div>
<div class="item">
<strong>Z</strong> &nbsp {{motion.z}}
</div>
<div class="item">
<strong>Time</strong> &nbsp {{motion.timestamp}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getAcceleration()">
Get Device Motion
</button>
<div class="button-bar">
<button class="button button-stable" ng-click="watchAcceleration()">
Watch
</button>
<button class="button button-assertive" ng-click="clearWatch()">
Clear
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,41 @@
angular.module('demo.deviceOrientation.ctrl', [])
.controller('DeviceOrientationCtrl', function ($scope, $timeout, $cordovaDeviceOrientation) {
var options = {frequency: 1000}; // Update every 1 seconds
$scope.getHeading = function () {
$cordovaDeviceOrientation
.getCurrentHeading()
.then(function (position) {
$scope.heading = position;
}, function (err) {
$scope.msg = err.message;
});
};
$scope.watchHeading = function () {
$scope.this_watch = $cordovaDeviceOrientation.watchHeading(options);
$scope.this_watch.then(
function () {
/* unused */
},
function (err) {
$scope.msg = err.message;
},
function (position) {
$timeout(function () {
$scope.heading = position;
});
}
);
};
$scope.clearWatch = function () {
$cordovaDeviceOrientation.clearWatch($scope.this_watch.watchID);
};
});

View File

@@ -0,0 +1,40 @@
<ion-view title="Device Orientation">
<ion-content>
<div class="card">
<div class="item item-divider">
Compass Tool
</div>
<div class="item item-body">
<strong>Magnetic Heading</strong> &nbsp {{heading.magneticHeading}}
</div>
<div class="item item-body">
<strong>True Heading</strong> &nbsp {{heading.trueHeading}}
</div>
<div class="item item-body">
<strong>Accuracy </strong> &nbsp {{heading.headingAccuracy}}
</div>
<div class="item item-body">
<strong>Timestamp </strong> &nbsp {{heading.timestamp}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getHeading()">
Get Current Heading
</button>
<div class="button-bar">
<button class="button button-stable" ng-click="watchHeading()">
Watch
</button>
<button class="button button-assertive" ng-click="clearWatch()">
Clear
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,33 @@
angular.module('demo.dialogs.ctrl', [])
.controller('DialogsCtrl', function ($scope, $cordovaDialogs) {
$scope.action = "Press any button";
$scope.alert = function () {
$scope.action = "Alert";
$cordovaDialogs.alert('Wow!');
};
$scope.confirm = function () {
$scope.action = "Confirm";
$cordovaDialogs.confirm('Are you sure?', "Custom title").then(function (buttonIndex) {
$cordovaDialogs.alert("Button index : " + buttonIndex);
});
};
$scope.prompt = function () {
$scope.action = "Prompt";
$cordovaDialogs.prompt('Please Login', "Custom title").then(function (result) {
$cordovaDialogs.alert("Input: " + result.input1 + "\n Button index : " + result.buttonIndex);
});
};
$scope.beep = function () {
$scope.action = "Beep";
$cordovaDialogs.beep(3);
};
});

View File

@@ -0,0 +1,32 @@
<ion-view title="Dialogs">
<ion-content>
<div class="card">
<div class="item item-text-wrap text-center">
<strong>{{action}}</strong>
</div>
<div class="item">
<button class="button button-block button-assertive" ng-click="alert()">
Alert
</button>
<br>
<button class="button button-block button-balanced" ng-click="confirm()">
Confirm
</button>
<br>
<button class="button button-block button-energized" ng-click="prompt()">
Prompt
</button>
<br>
<button class="button button-block button-royal" ng-click="beep()">
Beep
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,41 @@
angular.module('demo.emailComposer.ctrl', [])
.controller('EmailComposerCtrl', function ($scope, $cordovaEmailComposer) {
document.addEventListener("deviceready", function () {
$cordovaEmailComposer.isAvailable().then(function () {
alert("Email composer is available")
}, function () {
alert("Email composer is NOT available")
});
}, false);
$cordovaEmailComposer.isAvailable().then(function () {
// is available
}, function () {
// not available
});
var email = {
to: 'max@mustermann.de',
cc: 'erika@mustermann.de',
bcc: ['john@doe.com', 'jane@doe.com'],
attachments: [
'file://img/logo.png',
'res://icon.png',
'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
'file://README.pdf'
],
subject: 'Cordova Icons',
body: 'How are you? Nice greetings from Leipzig',
isHtml: true
};
$cordovaEmailComposer.open(email).then(null, function () {
// user cancelled email
});
});

View File

@@ -0,0 +1,7 @@
<ion-view title="Email Composer">
<ion-content>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,42 @@
angular.module('demo.facebook.ctrl', [])
.controller('FacebookCtrl', function ($scope, $log, $cordovaFacebook) {
$scope.getLoginStatus = function () {
$cordovaFacebook.getLoginStatus().then(function (status) {
$scope.status = status;
}, function (error) {
$scope.status = error;
})
};
$scope.login = function () {
$cordovaFacebook.login(["public_profile"]).then(function (success) {
$scope.loginInfo = success;
}, function (error) {
$scope.error = error;
alert(error);
})
};
$scope.logout = function () {
$cordovaFacebook.logout().then(function (success) {
console.log(success);
}, function (error) {
$scope.error = error;
alert(error);
})
};
$scope.getMe = function () {
$scope.me = ["refreshing..."];
$cordovaFacebook.api("me", null).then(function (success) {
$scope.me = success;
}, function (error) {
$scope.error = error;
})
};
});

View File

@@ -0,0 +1,36 @@
<ion-view title="Facebook">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="login()">Login</button>
<h5>Login info</h5>
<div ng-repeat="info in loginInfo">{{info}}</div>
<div class="card">
<div class="item item-divider">Login Info</div>
<div class="item" ng-repeat="info in loginInfo">{{info}}</div>
</div>
<button class="button button-block button-dark" ng-click="getLoginStatus()">Check Login Status</button>
<div class="card">
<div class="item item-divider">Login Status</div>
<div class="item" ng-repeat="info in status">{{info}}</div>
</div>
<button class="button button-block button-energized" ng-click="getMe()">API - get Me</button>
<h5>Api Me info</h5>
<div class="card">
<div class="item item-divider">Api Me info</div>
<div class="item" ng-repeat="info in me">{{info}}</div>
</div>
<button class="button button-block button-assertive" ng-click="logout()">Logout</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,234 @@
angular.module('demo.file.ctrl', [])
.controller('FileCtrl', function ($scope, $log, $cordovaFile, $window, $q, $cordovaFileError) {
$scope.inputs = {
checkDir: "test_directory",
checkFile: "test_file.txt",
createDirectory: "test_directory",
createFile: "test_file.txt",
removeDirectory: "test_directory",
removeFile: "test_file.txt",
removeRecursively: "test_directory/test_file.txt",
writeText: "THIS TEXT IS WRITTEN TO THIS FILE",
writeFile: "test_file.txt",
writeExistingText: "Write this text to an existing file",
writeExistingFile: "test_file.txt",
readFile: "test_file.txt",
moveDirectory: "test_directory",
moveFile: "test_file.txt",
copyDirectory: "test_directory",
copyFile: "test_file.txt"
};
$scope.test = function () {
document.addEventListener('deviceready', function () {
var newPath = cordova.file.applicationDirectory;
var test = DirectoryEntry(newPath);
console.log(test);
console.log(DirectoryEntry);
/*
try {
var path = cordova.file.applicationDirectory;
var newFileName;
var fileName = newFileName = "test_file.txt";
var newPath = cordova.file.tempDirectory;
var q = $q.defer();
$window.resolveLocalFileSystemURL(path, function (fileSystem) {
fileSystem.getFile(fileName, {create: false}, function (fileEntry) {
var newPathName = newPath.substring(newPath.lastIndexOf('/'));
console.log(newPathName);
//var parentEntry = new DirectoryEntry(newPathName, newPath);
fileEntry.moveTo(newPath, newFileName, function (result) {
console.log(result)
}, function (error) {
console.log(error)
});
}, function (err) {
console.log(err);
});
}, function (er) {
console.log(er);
});
} catch (e) {
console.log(e);
}
*/
});
};
$scope.checkDir = function () {
document.addEventListener('deviceready', function () {
// path, directory
$cordovaFile.checkDir(cordova.file.dataDirectory, $scope.inputs.checkDir).then(function (success) {
$scope.checkDirResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.checkDirResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.checkFile = function () {
document.addEventListener('deviceready', function () {
// path, file
$cordovaFile.checkFile(cordova.file.dataDirectory, $scope.inputs.checkFile).then(function (success) {
$scope.checkFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.checkFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.createDirectory = function () {
document.addEventListener('deviceready', function () {
// path, dirName, replace?
$cordovaFile.createDir(cordova.file.dataDirectory, $scope.inputs.createDirectory, false).then(function (success) {
$scope.createDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.createDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.createFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, replace?
$cordovaFile.createFile(cordova.file.dataDirectory, $scope.inputs.createFile, true).then(function (success) {
$scope.createFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.createFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName
$cordovaFile.removeFile(cordova.file.dataDirectory, $scope.inputs.removeFile).then(function (success) {
$scope.removeFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeDirectory = function () {
document.addEventListener('deviceready', function () {
// path, dirName
$cordovaFile.removeDir(cordova.file.dataDirectory, $scope.inputs.removeDirectory).then(function (success) {
$scope.removeDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeRecursively = function () {
document.addEventListener('deviceready', function () {
// path, dirName
$cordovaFile.removeRecursively(cordova.file.dataDirectory, $scope.inputs.removeDirectory).then(function (success) {
$scope.removeRecursivelyResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeRecursivelyResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.writeFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, text, replace?
$cordovaFile.writeFile(cordova.file.dataDirectory, $scope.inputs.writeFile, $scope.inputs.writeText, true).then(function (success) {
$scope.writeFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.writeFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.writeExistingFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, text
$cordovaFile.writeExistingFile(cordova.file.dataDirectory, $scope.inputs.writeExistingFile, $scope.inputs.writeExistingText).then(function (success) {
$scope.writeExistingFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.writeExistingFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.readFileAsText = function () {
document.addEventListener('deviceready', function () {
// path, fileName
$cordovaFile.readAsText(cordova.file.dataDirectory, $scope.inputs.readFile).then(function (success) {
$scope.readFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.readFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.moveDir = function () {
document.addEventListener('deviceready', function () {
// path, DirName, newPath, newDirName
$cordovaFile.moveDir(cordova.file.dataDirectory, $scope.inputs.moveDirectory, cordova.file.tempDirectory, "new_directory").then(function (success) {
$scope.moveDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.moveDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.moveFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, newPath, newFileName
$cordovaFile.moveFile(cordova.file.dataDirectory, $scope.inputs.moveFile, cordova.file.tempDirectory, "new_file.txt").then(function (success) {
$scope.moveFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.moveFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.copyDir = function () {
document.addEventListener('deviceready', function () {
// path, dirName, newPath, dirFileName
$cordovaFile.copyDir(cordova.file.dataDirectory, $scope.inputs.copyDirectory, cordova.file.tempDirectory, "new_directory").then(function (success) {
$scope.copyDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.copyDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.copyFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, newPath, newFileName
$cordovaFile.copyFile(cordova.file.dataDirectory, $scope.inputs.copyFile, cordova.file.tempDirectory, "new_file.txt").then(function (success) {
$scope.copyFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.copyFileResult = 'error ' + JSON.stringify(error);
});
});
};
});

View File

@@ -0,0 +1,283 @@
<ion-view title="File">
<ion-content padding="false">
<button class="button button-full button-assertive" ng-click="test()">test</button>
<h4 class="padding-horizontal">CHECK</h4>
<div class="card">
<div class="item item-divider-ios">
Check Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Directory" ng-model="inputs.checkDir">
</label>
<button class="button button-small button-positive button-outline" ng-click="checkDir()">
Check Directory
</button>
</div>
<div class="item" ng-if="checkDirResult">
{{checkDirResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Check File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.checkFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="checkFile()">
Check File
</button>
</div>
<div class="item" ng-if="checkFileResult">
{{checkFileResult}}
</div>
</div>
<h4 class="padding-horizontal">CREATE</h4>
<div class="card">
<div class="item item-divider-ios">
Create Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.createDirectory">
</label>
<button class="button button-small button-balanced button-outline" ng-click="createDirectory()">
Create Directory
</button>
</div>
<div class="item" ng-if="createDirectoryResult">
{{createDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Create File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.createFile">
</label>
<button class="button button-small button-balanced button-outline" ng-click="createFile()">
Create File
</button>
</div>
<div class="item" ng-if="createFileResult">
{{createFileResult}}
</div>
</div>
<h4 class="padding-horizontal">REMOVE</h4>
<div class="card">
<div class="item item-divider-ios">
Remove File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeFile">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeFile()">
Remove File
</button>
</div>
<div class="item" ng-if="removeFileResult">
{{removeFileResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Remove Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeDirectory">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeDirectory()">
Remove Directory
</button>
</div>
<div class="item" ng-if="removeDirectoryResult">
{{removeDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Remove Recursively
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeRecursively">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeRecursively()">
Remove Recursive
</button>
</div>
<div class="item" ng-if="removeRecursivelyResult">
{{removeRecursivelyResult}}
</div>
</div>
<h4 class="padding-horizontal">WRITE</h4>
<div class="card">
<div class="item item-divider-ios">
Write File
</div>
<div class="item">
<label class="item item-input">
<input type="text" placeholder="text" ng-model="inputs.writeText">
</label>
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.writeFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="writeFile()">
Write File
</button>
</div>
<div class="item" ng-if="writeFileResult">
{{writeFileResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Write Existing File
</div>
<div class="item">
<label class="item item-input">
<input type="text" placeholder="text" ng-model="inputs.writeExistingText">
</label>
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.writeExistingFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="writeExistingFile()">
Write Existing File
</button>
</div>
<div class="item item-text-wrap" ng-if="writeExistingFileResult">
{{writeExistingFileResult}}
</div>
</div>
<h4 class="padding-horizontal">READ</h4>
<div class="card">
<div class="item item-divider-ios">
Read File As Text
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.readFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="readFileAsText()">
Read File
</button>
</div>
<div class="item item-text-wrap" ng-if="readFileResult">
{{readFileResult}}
</div>
</div>
<h4 class="padding-horizontal">MOVE</h4>
<div class="card">
<div class="item item-divider-ios">
Move Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.moveDirectory">
</label>
<button class="button button-small button-royal button-outline" ng-click="moveDir()">
Move File
</button>
</div>
<div class="item" ng-if="moveDirectoryResult">
{{moveDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Move File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.moveFile">
</label>
<button class="button button-small button-royal button-outline" ng-click="moveFile()">
Move File
</button>
</div>
<div class="item" ng-if="moveFileResult">
{{moveFileResult}}
</div>
</div>
<h4 class="padding-horizontal">COPY</h4>
<div class="card">
<div class="item item-divider-ios">
Copy Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.copyDirectory">
</label>
<button class="button button-small button-energized button-outline" ng-click="copyDir()">
Copy Directory
</button>
</div>
<div class="item" ng-if="copyDirectoryResult">
{{copyDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Copy File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.copyFile">
</label>
<button class="button button-small button-energized button-outline" ng-click="copyFile()">
Copy File
</button>
</div>
<div class="item" ng-if="copyFileResult">
{{copyFileResult}}
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,25 @@
angular.module('demo.fileOpener2.ctrl', [])
.controller('FileOpener2Ctrl', function ($scope, $log, $cordovaFileOpener2) {
$scope.packageId = '';
$scope.type = '';
$scope.logs = '';
$scope.open = function() {
$cordovaFileOpener2.open(
$scope.packageId,
$scope.type
).then(
function(){
$scope.logs = 'Success';
},
function(error) {
alert('error code: '+error.code+' , message: '+error.message);
$scope.logs = 'error code: '+error.code+' , message: '+error.message;
}
);
};
});

View File

@@ -0,0 +1,19 @@
<ion-view title="FileOpener2">
<ion-content padding="true">
<div class="list">
<label class="item item-input">
<input type="text" placeholder="packageID" ng-model="packageId">
</label>
<label class="item item-input">
<input type="text" placeholder="type" ng-model="type">
</label>
<button class="button button-block button-positive" ng-click="open()">
Open
</button>
</div>
{{ logs }}
</ion-content>
</ion-view>

View File

@@ -0,0 +1,32 @@
angular.module('demo.fileTransfer.ctrl', [])
.controller('FileTransferCtrl', function ($scope, $rootScope, $cordovaFileTransfer, $timeout) {
$scope.downloadFile = function () {
document.addEventListener('deviceready', function () {
var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg";
var fileDir = cordova.file.documentsDirectory + "testImage.png";
var download = $cordovaFileTransfer.download(url, fileDir).then(function (success) {
console.log("success " + JSON.stringify(success));
$timeout(function () {
$scope.downloadProgress = 100
}, 1000);
}, function (error) {
console.log("Error " + JSON.stringify(error));
}, function (progress) {
$timeout(function () {
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
});
});
if ($scope.downloadProgress > 0.1) {
download.abort();
}
})
};
});

View File

@@ -0,0 +1,12 @@
<ion-view title="File Transfer">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="downloadFile()">Download File</button>
<div class="card" ng-if="downloadProgress">
<div class="item item-text-wrap">
Progress : {{downloadProgress}}%
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,11 @@
angular.module('demo.flashlight.ctrl', [])
.controller('FlashlightCtrl', function ($scope, $cordovaFlashlight) {
$scope.on = function () {
$cordovaFlashlight.switchOn();
};
$scope.off = function () {
$cordovaFlashlight.switchOff();
};
});

View File

@@ -0,0 +1,11 @@
<ion-view title="Flashlight">
<ion-content scroll="false" padding="true">
<button ng-click="on()" class="button button-block button-energized">On</button>
<button ng-click="off()" class="button button-block button-dark">Off</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,20 @@
angular.module('demo.geolocation.ctrl', [])
.controller('GeolocationCtrl', function ($scope, $cordovaGeolocation) {
$scope.getLocation = function () {
$cordovaGeolocation
.getCurrentPosition({timeout: 10000, enableHighAccuracy: false})
.then(function (position) {
console.log("position found");
$scope.position = position;
// long = position.coords.longitude
// lat = position.coords.latitude
}, function (err) {
console.log("unable to find location");
$scope.errorMsg = "Error : " + err.message;
});
};
});

View File

@@ -0,0 +1,27 @@
<ion-view title="Geolocation">
<ion-content>
<div class="card">
<div class="item item-divider">
Get My Current Location
</div>
<div class="item">
<strong>Longitude </strong> &nbsp {{position.coords.longitude}}
</div>
<div class="item">
<strong>Latitude </strong> &nbsp {{position.coords.latitude}}
</div>
<div class="item" ng-show="errorMsg">
<p>{{errorMsg}}</p>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getLocation()">
Get My Location
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,50 @@
angular.module('demo.globalization.ctrl', [])
.controller('GlobalizationCtrl', function ($scope, $cordovaGlobalization) {
function init() {
$cordovaGlobalization.getPreferredLanguage().then(
function (result) {
$scope.language = result.value;
},
function (error) {
$scope.language = err.message;
});
$cordovaGlobalization.getLocaleName().then(
function (result) {
$scope.locale = result.value;
},
function (error) {
$scope.locale = err.message;
});
$cordovaGlobalization.getFirstDayOfWeek().then(
function (result) {
$scope.fdow = result.value;
},
function (error) {
$scope.fdow = err.message;
});
}
$scope.refresh = function () {
init();
};
init();
// Soon implemented:
// dateToString
// stringToDate
// getDatePattern
// getDateNames
// isDayLightSavingsTime
// numberToString
// stringToNumber
// getNumberPattern
// getCurrencyPattern
});

View File

@@ -0,0 +1,25 @@
<ion-view title="Globalization">
<ion-content>
<div class="card">
<div class="item item-divider">
Globalization Values
</div>
<div class="item item-body">
<strong>Language </strong> &nbsp {{language}}
</div>
<div class="item">
<strong>Locale </strong> &nbsp {{locale}}
</div>
<div class="item">
<strong>First Day of Week </strong> &nbsp {{fdow}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="refresh()">
Refresh
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.googleAnalytics.ctrl', [])
.controller('GoogleAnalyticsCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Google Analytics">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,53 @@
angular.module('demo.healthkit.ctrl', [])
.controller('HealthKitCtrl', function($scope, $cordovaHealthKit) {
$cordovaHealthKit.isAvailable().then(function(success) {
alert('HealthKit Available');
}, function(err) {
alert('HealthKit NOT Available');
});
$scope.request = function() {
$cordovaHealthKit.requestAuthorization().then(function(success) {
$scope.granted = true;
}, function(err) {
$scope.granted = false;
});
};
$scope.checkAuth = function() {
$cordovaHealthKit.checkAuthStatus().then(function(success) {
$scope.granted = true;
}, function(err) {
$scope.granted = false;
});
};
$scope.readDOB = function() {
$cordovaHealthKit.readDateOfBirth().then(function(dob) {
alert('DOB ' + dob);
}, function(err) {
alert(err);
});
};
$scope.readGender = function() {
$cordovaHealthKit.readGender().then(function(gender) {
alert('Gender ' + gender);
}, function(err) {
alert(err);
});
};
$scope.readWeight = function() {
$cordovaHealthKit.readWeight().then(function(v) {
alert('Weight ' + JSON.stringify(v));
}, function(err) {
alert(err);
});
};
$scope.readHeight = function() {
$cordovaHealthKit.readHeight().then(function(v) {
alert('Height ' + JSON.stringify(v));
}, function(err) {
alert(err);
});
}
});

View File

@@ -0,0 +1,14 @@
<ion-view title="HealthKit (iOS Only)">
<ion-content>
<h1 class="text-center">HealthKit</h1>
<p>
Authorization: <b ng-if="granted">Granted</b><b ng-if="!granted">Not granted</b>
</p>
<button class="button button-assertive" ng-click="checkAuth()">Check Authorization</button>
<button class="button button-assertive" ng-click="request()">Request Authorization</button>
<button class="button button-assertive" ng-click="readDOB()">DOB</button>
<button class="button button-assertive" ng-click="readGender()">Gender</button>
<button class="button button-assertive" ng-click="readWeight()">Weight</button>
<button class="button button-assertive" ng-click="readHeight()">Height</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,34 @@
angular.module('demo.inAppBrowser.ctrl', [])
.controller('InAppBrowserCtrl', function ($scope, $rootScope, $cordovaInAppBrowser) {
$scope.openBrowser = function () {
document.addEventListener('deviceready', function () {
var options = {
location: "no"
};
$cordovaInAppBrowser.open('http://ngcordova.com', '_blank', options).then(function () {
console.log("InAppBrowser opened http://ngcordova.com successfully");
}, function (error) {
console.log("Error: " + error);
});
}, false);
};
document.addEventListener('deviceready', function () {
$rootScope.$on("$cordovaInAppBrowser:exit", function (event, result) {
alert("Exited Browser");
console.log(JSON.stringify(result));
});
$rootScope.$on("$cordovaInAppBrowser:loadstop", function (event, result) {
alert("Load Stop event");
console.log(JSON.stringify(result));
})
}, false);
});

View File

@@ -0,0 +1,6 @@
<ion-view title="In App Browser">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="openBrowser()">Open Browser</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,9 @@
module.controller('MyCtrl', function($cordovaInsomnia) {
//Keep Screen on | prevent screen sleep
$cordovaInsomnia.keepAwake();
//return to standard. Aloow Sleep Again
$cordovaInsomnia.allowSleepAgain();
});

View File

@@ -0,0 +1,30 @@
angular.module('demo.localNotification.ctrl', [])
.controller('LocalNotificationCtrl', function ($scope, $rootScope, $cordovaLocalNotification) {
$scope.addNotification = function () {
var now = new Date();
var _60_seconds_from_now = new Date(now + 60 * 1000);
var event = {
id: 1,
at: _60_seconds_from_now,
title: "Test Event",
text: "this is a message about the event"
};
document.addEventListener("deviceready", function () {
$cordovaLocalNotification.schedule(event).then(function () {
console.log("local add : success");
});
}, false);
};
document.addEventListener("deviceready", function () {
$rootScope.$on("$cordovaLocalNotification:trigger", function (event, notification, state) {
console.log("notification id:" + notification.id + " state: " + state);
});
}, false);
});

View File

@@ -0,0 +1,6 @@
<ion-view title="Local Notification">
<ion-content padding="true">
<button class="button button-block" ng-click="addNotification()">Add Notification</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,60 @@
angular.module('demo.media.ctrl', [])
.controller('MediaCtrl', function ($scope, $ionicPlatform, $cordovaMedia) {
var thisMedia;
$ionicPlatform.ready(function () {
thisMedia = $cordovaMedia.newMedia('/sample.mp3');
});
$scope.playMedia = function () {
thisMedia.play().then(function(){
// success
//Perform some action when playback finishes like playNext()
console.log("fire when playback finishes");
}, null, function(data){
if(data.status){
//Watch for status changes from the Media plugin, perform some action on start, stop, pause etc
//Media.MEDIA_NONE = 0;
//Media.MEDIA_STARTING = 1;
//Media.MEDIA_RUNNING = 2;
//Media.MEDIA_PAUSED = 3;
//Media.MEDIA_STOPPED = 4;
console.log(data.status);
};
if(data.duration){
//gets the duration of the current track, perform some action with the duration
console.log("track duration: " +data.duration);
};
if(data.position){
//Update the current playback position every second
console.log('track progress: ' + data.position);
};
});
console.log("play media");
};
$scope.stopMedia = function () {
thisMedia.pause();
};
$scope.getCurrentPosition = function () {
thisMedia.currentTime().then(function(position){
console.log("current playback position is:" + position);
});
};
$scope.getDuration = function () {
thisMedia.getDuration().then(function(duration){
console.log("media duration is:" + duration);
});
};
});

View File

@@ -0,0 +1,11 @@
<ion-view title="Media">
<ion-content padding="true">
<br>
<div class="button button-block" ng-click="playMedia()">Play</div>
<p>{{media}}</p>
<div class="button button-block" ng-click="stopMedia()">Stop</div>
</ion-content>
</ion-view>

Binary file not shown.

View File

@@ -0,0 +1,197 @@
<ion-view title="Menu">
<ion-content>
<div class="list">
<a class="item item-icon-right" ui-sref="appAvailability">
<i class="icon ion-information-circled"></i>
App Availability
</a>
<a class="item item-icon-right" ui-sref="appRate">
<i class="icon ion-chatbox-working"></i>
App Rate
</a>
<a class="item item-icon-right" ui-sref="barcodeScanner">
<i class="icon ion-ios7-barcode positive"></i>
Barcode Scanner
</a>
<a class="item item-icon-right" ui-sref="batteryStatus">
<i class="icon ion-battery-charging assertive"></i>
Battery Status
</a>
<a class="item item-icon-right" ui-sref="beacon">
<i class="icon ion-location"></i>
Beacon
</a>
<a class="item item-icon-right" ui-sref="camera">
<i class="icon ion-ios7-camera"></i>
Camera
</a>
<a class="item item-icon-right" ui-sref="clipboard">
<i class="icon ion-ios7-copy"></i>
Clipboard
</a>
<a class="item item-icon-right" ui-sref="contacts">
<i class="icon ion-person-stalker balanced"></i>
Contacts
</a>
<a class="item item-icon-right" ui-sref="datePicker">
<i class="icon ion-ios7-calendar-outline"></i>
Date picker
</a>
<a class="item item-icon-right" ui-sref="device">
<i class="icon ion-iphone"></i>
Device
</a>
<a class="item item-icon-right" ui-sref="deviceMotion">
<i class="icon ion-radio-waves assertive"></i>
Device Motion
</a>
<a class="item item-icon-right" ui-sref="deviceOrientation">
<i class="icon ion-compass"></i>
Device Orientation
</a>
<a class="item item-icon-right" ui-sref="dialogs">
<i class="icon ion-chatbubbles"></i>
Dialogs
</a>
<a class="item item-icon-right" ui-sref="emailComposer">
<i class="icon ion-ios7-email"></i>
Email Composer
</a>
<a class="item item-icon-right" ui-sref="facebook">
<i class="icon ion-social-facebook positive"></i>
Facebook
</a>
<a class="item item-icon-right" ui-sref="file">
<i class="icon ion-folder"></i>
File
</a>
<a class="item item-icon-right" ui-sref="fileTransfer">
<i class="icon ion-ios7-cloud-download positive"></i>
File Transfer
</a>
<a class="item item-icon-right" ui-sref="fileOpener2">
<i class="icon ion-folder"></i>
FileOpener2
</a>
<a class="item item-icon-right" ui-sref="flashlight">
<i class="icon ion-flash energized"></i>
Flashlight
</a>
<a class="item item-icon-right" ui-sref="geolocation">
<i class="icon ion-pin assertive"></i>
GeoLocation
</a>
<a class="item item-icon-right" ui-sref="globalization">
<i class="icon ion-earth balanced"></i>
Globalization
</a>
<a class="item item-icon-right" ui-sref="healthkit">
<i class="icon ion-heart balanced"></i>
HealthKit
</a>
<a class="item item-icon-right" ui-sref="inAppBrowser">
<i class="icon ion-iphone"></i>
In App Browser
</a>
<a class="item item-icon-right" ui-sref="localNotification">
<i class="icon ion-alert assertive"></i>
Local Notification
</a>
<a class="item item-icon-right" ui-sref="media">
<i class="icon ion-ios7-film"></i>
Media
</a>
<a class="item item-icon-right" ui-sref="network">
<i class="icon ion-connection-bars"></i>
Network
</a>
<a class="item item-icon-right" ui-sref="oauth">
<i class="icon ion-arrow-expand"></i>
Oauth
</a>
<a class="item item-icon-right" ui-sref="preferences">
<i class="icon ion-settings"></i>
Preferences
</a>
<a class="item item-icon-right" ui-sref="printer">
<i class="icon ion-printer"></i>
Printer
</a>
<a class="item item-icon-right" ui-sref="pushNotifications">
<i class="icon ion-arrow-up-a"></i>
Push Notifications
</a>
<a class="item item-icon-right" ui-sref="socialSharing">
<i class="icon ion-share"></i>
Social Sharing
</a>
<a class="item item-icon-right" ui-sref="sqlite">
<i class="icon ion-drag"></i>
SQLite
</a>
<a class="item item-icon-right" ui-sref="statusbar">
<i class="icon ion-minus"></i>
Statusbar
</a>
<a class="item item-icon-right" ui-sref="toast">
<i class="icon ion-ios7-chatboxes"></i>
Toast
</a>
<a class="item item-icon-right" ui-sref="touchid">
<i class="icon ion-ios7-circle-filled"></i>
TouchID
</a>
<a class="item item-icon-right" ui-sref="vibration">
<i class="icon ion-arrow-expand"></i>
Vibration
</a>
<a class="item item-icon-right" ui-sref="upsPushNotifications">
<i class="icon ion-arrow-up-a"></i>
Unified Push Notifications
</a>
<a class="item item-icon-right" ui-sref="about">
About
</a>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,22 @@
angular.module('demo.network.ctrl', [])
.controller('NetworkCtrl', function ($scope, $cordovaNetwork) {
$scope.networkType = null;
$scope.connectionType = null;
document.addEventListener("deviceready", function () {
$scope.networkType = $cordovaNetwork.getNetwork();
if ($cordovaNetwork.isOnline()) {
$scope.connectionType = 'Online';
}
else if ($cordovaNetwork.isOffline()) {
$scope.connectionType = 'Offline';
}
else {
$scope.errorMsg = 'Error getting isOffline / isOnline methods';
}
}, false);
});

View File

@@ -0,0 +1,19 @@
<ion-view title="Network">
<ion-content padding="true">
<div class="card">
<div class="item">
<strong>You are currently</strong> &nbsp {{connectionType}}
</div>
<div class="item">
<strong>Network Type</strong> &nbsp {{networkType}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="refresh()">
Refresh
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,132 @@
angular.module('demo.oauth.ctrl', [])
.controller('OauthCtrl', function ($scope, $cordovaOauth) {
$scope.instagramLogin = function () {
$cordovaOauth.instagram("CLIENT_ID_HERE", ["basic", "likes"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.digitalOceanLogin = function () {
$cordovaOauth.digitalOcean("CLIENT_ID_HERE", "CLIENT_SECRET_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.dropboxLogin = function () {
$cordovaOauth.dropbox("APP_ID_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.googleLogin = function () {
$cordovaOauth.google("CLIENT_ID_HERE", ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.githubLogin = function () {
$cordovaOauth.github("CLIENT_ID_HERE", "CLIENT_SECRET_HERE", ["user"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.facebookLogin = function () {
$cordovaOauth.facebook("CLIENT_ID_HERE", ["email"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.linkedinLogin = function () {
$cordovaOauth.linkedin("CLIENT_ID_HERE", "CLIENT_SECRET_HERE", ["r_emailaddress"], "RANDOM_STATE_STRING_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.boxLogin = function () {
$cordovaOauth.box("CLIENT_ID_HERE", "CLIENT_SECRET_HERE", "RANDOM_STATE_STRING_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.redditLogin = function () {
$cordovaOauth.reddit("CLIENT_ID_HERE", "CLIENT_SECRET_HERE", ["edit"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.twitterLogin = function () {
$cordovaOauth.twitter("CONSUMER_ID_HERE", "CONSUMER_SECRET_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.meetupLogin = function () {
$cordovaOauth.meetup("CONSUMER_ID_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.foursquareLogin = function () {
$cordovaOauth.foursquare("CLIENT_ID_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.salesforceLogin = function () {
$cordovaOauth.salesforce("LOGIN_URL_HERE", "CLIENT_ID_HERE").then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
$scope.stravaLogin = function () {
$cordovaOauth.strava("CLIENT_ID_HERE", "CLIENT_SECRET_HERE", ["SCOPE1", "SCOPE2"]).then(function (result) {
$scope.oauthResult = result;
}, function (error) {
$scope.oauthResult = "OAUTH ERROR (see console)";
console.log(error);
});
};
});

View File

@@ -0,0 +1,22 @@
<ion-view title="Oauth">
<ion-content scroll="false" padding="true">
<button ng-click="instagramLogin()" class="button button-block button-primary">Instagram</button>
<button ng-click="facebookLogin()" class="button button-block button-primary">Facebook</button>
<button ng-click="googleLogin()" class="button button-block button-primary">Google</button>
<button ng-click="linkedinLogin()" class="button button-block button-primary">LinkedIn</button>
<button ng-click="dropboxLogin()" class="button button-block button-primary">Dropbox</button>
<button ng-click="digitalOceanLogin()" class="button button-block button-primary">Digital Ocean</button>
<button ng-click="githubLogin()" class="button button-block button-primary">GitHub</button>
<button ng-click="boxLogin()" class="button button-block button-primary">Box</button>
<button ng-click="redditLogin()" class="button button-block button-primary">Reddit</button>
<button ng-click="twitterLogin()" class="button button-block button-primary">Twitter</button>
<button ng-click="meetupLogin()" class="button button-block button-primary">Meetup</button>
<button ng-click="foursquareLogin()" class="button button-block button-primary">Foursquare</button>
<button ng-click="salesforceLogin()" class="button button-block button-primary">Salesforce</button>
<button ng-click="stravaLogin()" class="button button-block button-primary">Strava</button>
<div ng-bind="oauthResult">
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,33 @@
angular.module('demo.preferences.ctrl', [])
.controller('PreferencesCtrl', function ($scope, $log, $cordovaPreferences) {
var key = 'exampleKey';
$scope.data = {};
$scope.data.showMore = false;
$scope.data.key = key;
$scope.preferencesSet = function () {
$cordovaPreferences.set(key, $scope.data.value)
.then(function (result) {
if (result) {
$log.log(key + ' was succesfully set to:', $scope.data.value);
$scope.data.showMore = true;
} else {
$log.log(key + ' was not set to: ' + $scope.data.value + ' we got ', result);
}
}, function (err) {
$log.log(key + ' was not set to: ' + $scope.data.value + ' due to', err);
});
};
$scope.preferencesGet = function () {
$cordovaPreferences.get(key)
.then(function (value) {
$log.log(key + ' get was succesfully:', value);
$scope.data.pref = value;
}, function (err) {
$log.log(key + ' get was not succesfully: ' + $scope.data.value + ' due to', err);
});
};
});

View File

@@ -0,0 +1,38 @@
<ion-view title="Preferences">
<ion-content>
<div class="list">
<form name="preferencesForm" ng-submit="preferencesSet()" novalidate>
<label class="item item-input">
<input type="text"
ng-model="data.value"
placeholder="Write something to be store in preferences">
</label>
<button class="button button-block button-positive"
ng-disabled="preferencesForm.$invalid">
$cordovaPreferences
.set('{{ data.key }}', '{{ data.value }}')
</button>
</form>
</div>
<div class="list card" ng-show="data.showMore">
<div class="item">
{{ data.pref }}
</div>
<div class="item item-text-wrap">
<button class="button button-stable"
ng-click="preferencesGet()">
$cordovaPreferences
.get('{{ data.key }}')
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.printer.ctrl', [])
.controller('PrinterCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Printer">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.pushNotifications.ctrl', [])
.controller('PushNotificationsCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Push Notifications">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.socialSharing.ctrl', [])
.controller('SocialSharingCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Social Sharing">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.sqlite.ctrl', [])
.controller('SqliteCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Social Sharing">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,12 @@
angular.module('demo.statusbar.ctrl', [])
.controller('StatusbarCtrl', function ($scope, $cordovaStatusbar) {
$scope.toggleBar = function () {
if ($cordovaStatusbar.isVisible()) {
$cordovaStatusbar.hide();
} else {
$cordovaStatusbar.show();
}
};
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Statusbar">
<ion-content scroll="false" padding="true">
<button ng-click="toggleBar()" class="button button-block button-positive">Toggle</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,38 @@
angular.module('demo.toast.ctrl', [])
.controller('ToastCtrl', function ($scope, $cordovaToast) {
$scope.toastMessage = 'enter a message';
$scope.center = function (message) {
$cordovaToast.show(message, 'long', 'center')
.then(function (success) {
console.log("center msg displayed");
}, function (error) {
$scope.msg = error.message;
});
};
$scope.top = function (message) {
$cordovaToast
.showShortTop(message)
.then(function (success) {
console.log("short top displayed ");
}, function (error) {
$scope.msg = error.message;
});
};
$scope.bottom = function (message) {
$cordovaToast
.showLongBottom(message)
.then(function (success) {
console.log("long bottom displayed");
}, function (error) {
$scope.msg = error.message;
});
}
});

View File

@@ -0,0 +1,29 @@
<ion-view title="Toast">
<ion-content>
<h1 class="text-center padding">Toast</h1>
<div class="list ">
<label class="item item-input">
<span class="input-label">Toast Message</span>
<input type="text" ng-model="toastMessage">
</label>
</div>
<div class="padding">
<button class="button button-block button-royal" ng-click="center(toastMessage)">
Center
</button>
<button class="button button-block button-positive" ng-click="top(toastMessage)">
Top
</button>
<button class="button button-block button-energized" ng-click="bottom(toastMessage)">
Bottom
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,26 @@
angular.module('demo.touchid.ctrl', [])
.controller('TouchIDCtrl', function ($scope, $cordovaTouchID) {
var supported = false;
$cordovaTouchID.checkSupport().then(function(val) {
supported = true;
}, function(err) {
supported = false;
});
$scope.prompt = function() {
if(!supported) {
alert('TouchID is not supported on your device.');
} else {
$cordovaTouchID.authenticate('Please authenticate').then(function(authVal) {
alert('Success!');
console.log(authVal);
}, function(err) {
alert(err);
console.log(err);
});
}
};
});

View File

@@ -0,0 +1,11 @@
<ion-view title="Touch ID">
<ion-content>
<h1 class="text-center">Touch ID</h1>
<div class="padding">
<button class="button button-block button-positive" ng-click="prompt()">
Authenticate
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,19 @@
angular.module('demo.upsPushNotifications.ctrl', [])
.controller('UpsPushNotificationsCtrl', function ($scope, $rootScope, $cordovaUpsPush) {
$scope.config = {};
$scope.register = function () {
$cordovaUpsPush.register($scope.config).then(function () {
console.log("successful registered");
}, function (err) {
alert("Registration error: " + err);
});
$rootScope.$on('$cordovaUpsPush:notificationReceived', function (event, notification) {
if (notification.alert) {
navigator.notification.alert(notification.alert);
}
});
};
});

View File

@@ -0,0 +1,25 @@
<ion-view title="Unified Push Notifications">
<ion-content class="has-header">
<div class="list">
<label class="item item-input">
<span class="input-label">Url</span>
<input type="text" ng-model="config.pushServerURL" placeholder="http(s)//host:port/context">
</label>
<label class="item item-input">
<span class="input-label">VariantID</span>
<input type="text" ng-model="config.varaintID" placeholder="1234456-234320">
</label>
<label class="item item-input">
<span class="input-label">VariantSecret</span>
<input type="text" ng-model="config.varaintSecret" placeholder="1234456-234320">
</label>
<label class="item item-input">
<span class="input-label">senderID</span>
<input type="text" ng-model="config.senderID" placeholder="Project ID only for android">
</label>
</div>
<button class="button button-block button-positive" ng-click="register()">
Register
</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,11 @@
angular.module('demo.vibration.ctrl', [])
.controller('VibrationCtrl', function($scope, $cordovaVibration) {
$scope.duration = 100;
$scope.vibrate = function(){
console.log("vibrating");
$cordovaVibration.vibrate($scope.duration);
}
});

View File

@@ -0,0 +1,11 @@
<ion-view title="Vibrate">
<ion-content>
<h1 class="text-center">Vibration</h1>
<div class="padding">
<button class="button button-block button-positive" ng-click="vibrate()">
Vibrate me!
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.ionicframework.ngCordovaDemoUnique"
versionCode=""
version = "">
<name>ngCordovaDemo</name>
<description>Demo app for ngCordova plugins </description>
</widget>

1776
www/lib/ngCordova/demo/www/cordova.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
/* Empty. Add your own CSS if you like */
.ace_content {
padding: 5px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>ng-cordova demo</title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- Facebook Plugin copy pasted from the plugin/facebookplugin/js/... for web-dev -->
<script src="lib/facebookConnectPlugin.js"></script>
<!-- ng cordova js -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="app/app.js"></script>
<script src="app/adMob/adMob.ctrl.js"></script>
<script src="app/appAvailability/appAvailability.ctrl.js"></script>
<script src="app/appRate/appRate.ctrl.js"></script>
<script src="app/barcodeScanner/barcodeScanner.ctrl.js"></script>
<script src="app/batteryStatus/batteryStatus.ctrl.js"></script>
<script src="app/beacon/beacon.ctrl.js"></script>
<script src="app/camera/camera.ctrl.js"></script>
<script src="app/clipboard/clipboard.ctrl.js"></script>
<script src="app/contacts/contacts.ctrl.js"></script>
<script src="app/datePicker/datePicker.ctrl.js"></script>
<script src="app/device/device.ctrl.js"></script>
<script src="app/deviceMotion/deviceMotion.ctrl.js"></script>
<script src="app/deviceOrientation/deviceOrientation.ctrl.js"></script>
<script src="app/dialogs/dialogs.ctrl.js"></script>
<script src="app/emailComposer/emailComposer.ctrl.js"></script>
<script src="app/facebook/facebook.ctrl.js"></script>
<script src="app/file/file.ctrl.js"></script>
<script src="app/fileOpener2/fileOpener2.ctrl.js"></script>
<script src="app/fileTransfer/fileTransfer.ctrl.js"></script>
<script src="app/flashlight/flashlight.ctrl.js"></script>
<script src="app/geolocation/geolocation.ctrl.js"></script>
<script src="app/globalization/globalization.ctrl.js"></script>
<script src="app/googleAnalytics/googleAnalytics.ctrl.js"></script>
<script src="app/inAppBrowser/inAppBrowser.ctrl.js"></script>
<script src="app/localNotification/localNotification.ctrl.js"></script>
<script src="app/media/media.ctrl.js"></script>
<script src="app/network/network.ctrl.js"></script>
<script src="app/oauth/oauth.ctrl.js"></script>
<script src="app/preferences/preferences.ctrl.js"></script>
<script src="app/printer/printer.ctrl.js"></script>
<script src="app/pushNotifications/pushNotifications.ctrl.js"></script>
<script src="app/socialSharing/socialSharing.ctrl.js"></script>
<script src="app/sqlite/sqlite.ctrl.js"></script>
<script src="app/statusbar/statusbar.ctrl.js"></script>
<script src="app/toast/toast.ctrl.js"></script>
<script src="app/touchid/touchid.ctrl.js"></script>
<script src="app/vibration/vibration.ctrl.js"></script>
<script src="app/healthkit/healthkit.ctrl.js"></script>
<script src="app/upsPushNotifications/pushNotifications.ctrl.js"></script>
</head>
<body ng-app="demo" animation="slide-left-right-ios7">
<ion-nav-bar class="bar-positive nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view>
</ion-nav-view>
</body>
</html>

View File

@@ -0,0 +1,19 @@
{
"name": "angular-animate",
"version": "1.3.6",
"main": "./angular-animate.js",
"ignore": [],
"dependencies": {
"angular": "1.3.6"
},
"homepage": "https://github.com/angular/bower-angular-animate",
"_release": "1.3.6",
"_resolution": {
"type": "version",
"tag": "v1.3.6",
"commit": "d38c9593911d231cce076c1b64f823e572813214"
},
"_source": "git://github.com/angular/bower-angular-animate.git",
"_target": "1.3.6",
"_originalSource": "angular-animate"
}

View File

@@ -0,0 +1,77 @@
# packaged angular-animate
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-animate
```
Add a `<script>` to your `index.html`:
```html
<script src="/node_modules/angular-animate/angular-animate.js"></script>
```
Then add `ngAnimate` as a dependency for your app:
```javascript
angular.module('myApp', ['ngAnimate']);
```
Note that this package is not in CommonJS format, so doing `require('angular-animate')` will
return `undefined`.
### bower
```shell
bower install angular-animate
```
Then add a `<script>` to your `index.html`:
```html
<script src="/bower_components/angular-animate/angular-animate.js"></script>
```
Then add `ngAnimate` as a dependency for your app:
```javascript
angular.module('myApp', ['ngAnimate']);
```
## Documentation
Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).
## License
The MIT License
Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
/*
AngularJS v1.3.6
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(N,f,W){'use strict';f.module("ngAnimate",["ng"]).directive("ngAnimateChildren",function(){return function(X,C,g){g=g.ngAnimateChildren;f.isString(g)&&0===g.length?C.data("$$ngAnimateChildren",!0):X.$watch(g,function(f){C.data("$$ngAnimateChildren",!!f)})}}).factory("$$animateReflow",["$$rAF","$document",function(f,C){return function(g){return f(function(){g()})}}]).config(["$provide","$animateProvider",function(X,C){function g(f){for(var n=0;n<f.length;n++){var g=f[n];if(1==g.nodeType)return g}}
function ba(f,n){return g(f)==g(n)}var t=f.noop,n=f.forEach,da=C.$$selectors,aa=f.isArray,ea=f.isString,ga=f.isObject,r={running:!0},u;X.decorator("$animate",["$delegate","$$q","$injector","$sniffer","$rootElement","$$asyncCallback","$rootScope","$document","$templateRequest","$$jqLite",function(O,N,M,Y,y,H,P,W,Z,Q){function R(a,c){var b=a.data("$$ngAnimateState")||{};c&&(b.running=!0,b.structural=!0,a.data("$$ngAnimateState",b));return b.disabled||b.running&&b.structural}function D(a){var c,b=N.defer();
b.promise.$$cancelFn=function(){c&&c()};P.$$postDigest(function(){c=a(function(){b.resolve()})});return b.promise}function I(a){if(ga(a))return a.tempClasses&&ea(a.tempClasses)&&(a.tempClasses=a.tempClasses.split(/\s+/)),a}function S(a,c,b){b=b||{};var d={};n(b,function(e,a){n(a.split(" "),function(a){d[a]=e})});var h=Object.create(null);n((a.attr("class")||"").split(/\s+/),function(e){h[e]=!0});var f=[],l=[];n(c&&c.classes||[],function(e,a){var b=h[a],c=d[a]||{};!1===e?(b||"addClass"==c.event)&&
l.push(a):!0===e&&(b&&"removeClass"!=c.event||f.push(a))});return 0<f.length+l.length&&[f.join(" "),l.join(" ")]}function T(a){if(a){var c=[],b={};a=a.substr(1).split(".");(Y.transitions||Y.animations)&&c.push(M.get(da[""]));for(var d=0;d<a.length;d++){var f=a[d],k=da[f];k&&!b[f]&&(c.push(M.get(k)),b[f]=!0)}return c}}function U(a,c,b,d){function h(e,a){var b=e[a],c=e["before"+a.charAt(0).toUpperCase()+a.substr(1)];if(b||c)return"leave"==a&&(c=b,b=null),u.push({event:a,fn:b}),J.push({event:a,fn:c}),
!0}function k(c,l,w){var E=[];n(c,function(a){a.fn&&E.push(a)});var m=0;n(E,function(c,f){var p=function(){a:{if(l){(l[f]||t)();if(++m<E.length)break a;l=null}w()}};switch(c.event){case "setClass":l.push(c.fn(a,e,A,p,d));break;case "animate":l.push(c.fn(a,b,d.from,d.to,p));break;case "addClass":l.push(c.fn(a,e||b,p,d));break;case "removeClass":l.push(c.fn(a,A||b,p,d));break;default:l.push(c.fn(a,p,d))}});l&&0===l.length&&w()}var l=a[0];if(l){d&&(d.to=d.to||{},d.from=d.from||{});var e,A;aa(b)&&(e=
b[0],A=b[1],e?A?b=e+" "+A:(b=e,c="addClass"):(b=A,c="removeClass"));var w="setClass"==c,E=w||"addClass"==c||"removeClass"==c||"animate"==c,p=a.attr("class")+" "+b;if(x(p)){var ca=t,m=[],J=[],g=t,s=[],u=[],p=(" "+p).replace(/\s+/g,".");n(T(p),function(a){!h(a,c)&&w&&(h(a,"addClass"),h(a,"removeClass"))});return{node:l,event:c,className:b,isClassBased:E,isSetClassOperation:w,applyStyles:function(){d&&a.css(f.extend(d.from||{},d.to||{}))},before:function(a){ca=a;k(J,m,function(){ca=t;a()})},after:function(a){g=
a;k(u,s,function(){g=t;a()})},cancel:function(){m&&(n(m,function(a){(a||t)(!0)}),ca(!0));s&&(n(s,function(a){(a||t)(!0)}),g(!0))}}}}}function G(a,c,b,d,h,k,l,e){function A(e){var l="$animate:"+e;J&&J[l]&&0<J[l].length&&H(function(){b.triggerHandler(l,{event:a,className:c})})}function w(){A("before")}function E(){A("after")}function p(){p.hasBeenRun||(p.hasBeenRun=!0,k())}function g(){if(!g.hasBeenRun){m&&m.applyStyles();g.hasBeenRun=!0;l&&l.tempClasses&&n(l.tempClasses,function(a){u.removeClass(b,
a)});var w=b.data("$$ngAnimateState");w&&(m&&m.isClassBased?B(b,c):(H(function(){var e=b.data("$$ngAnimateState")||{};fa==e.index&&B(b,c,a)}),b.data("$$ngAnimateState",w)));A("close");e()}}var m=U(b,a,c,l);if(!m)return p(),w(),E(),g(),t;a=m.event;c=m.className;var J=f.element._data(m.node),J=J&&J.events;d||(d=h?h.parent():b.parent());if(z(b,d))return p(),w(),E(),g(),t;d=b.data("$$ngAnimateState")||{};var L=d.active||{},s=d.totalActive||0,q=d.last;h=!1;if(0<s){s=[];if(m.isClassBased)"setClass"==q.event?
(s.push(q),B(b,c)):L[c]&&(v=L[c],v.event==a?h=!0:(s.push(v),B(b,c)));else if("leave"==a&&L["ng-leave"])h=!0;else{for(var v in L)s.push(L[v]);d={};B(b,!0)}0<s.length&&n(s,function(a){a.cancel()})}!m.isClassBased||m.isSetClassOperation||"animate"==a||h||(h="addClass"==a==b.hasClass(c));if(h)return p(),w(),E(),A("close"),e(),t;L=d.active||{};s=d.totalActive||0;if("leave"==a)b.one("$destroy",function(a){a=f.element(this);var e=a.data("$$ngAnimateState");e&&(e=e.active["ng-leave"])&&(e.cancel(),B(a,"ng-leave"))});
u.addClass(b,"ng-animate");l&&l.tempClasses&&n(l.tempClasses,function(a){u.addClass(b,a)});var fa=K++;s++;L[c]=m;b.data("$$ngAnimateState",{last:m,active:L,index:fa,totalActive:s});w();m.before(function(e){var l=b.data("$$ngAnimateState");e=e||!l||!l.active[c]||m.isClassBased&&l.active[c].event!=a;p();!0===e?g():(E(),m.after(g))});return m.cancel}function q(a){if(a=g(a))a=f.isFunction(a.getElementsByClassName)?a.getElementsByClassName("ng-animate"):a.querySelectorAll(".ng-animate"),n(a,function(a){a=
f.element(a);(a=a.data("$$ngAnimateState"))&&a.active&&n(a.active,function(a){a.cancel()})})}function B(a,c){if(ba(a,y))r.disabled||(r.running=!1,r.structural=!1);else if(c){var b=a.data("$$ngAnimateState")||{},d=!0===c;!d&&b.active&&b.active[c]&&(b.totalActive--,delete b.active[c]);if(d||!b.totalActive)u.removeClass(a,"ng-animate"),a.removeData("$$ngAnimateState")}}function z(a,c){if(r.disabled)return!0;if(ba(a,y))return r.running;var b,d,g;do{if(0===c.length)break;var k=ba(c,y),l=k?r:c.data("$$ngAnimateState")||
{};if(l.disabled)return!0;k&&(g=!0);!1!==b&&(k=c.data("$$ngAnimateChildren"),f.isDefined(k)&&(b=k));d=d||l.running||l.last&&!l.last.isClassBased}while(c=c.parent());return!g||!b&&d}u=Q;y.data("$$ngAnimateState",r);var $=P.$watch(function(){return Z.totalPendingRequests},function(a,c){0===a&&($(),P.$$postDigest(function(){P.$$postDigest(function(){r.running=!1})}))}),K=0,V=C.classNameFilter(),x=V?function(a){return V.test(a)}:function(){return!0};return{animate:function(a,c,b,d,h){d=d||"ng-inline-animate";
h=I(h)||{};h.from=b?c:null;h.to=b?b:c;return D(function(b){return G("animate",d,f.element(g(a)),null,null,t,h,b)})},enter:function(a,c,b,d){d=I(d);a=f.element(a);c=c&&f.element(c);b=b&&f.element(b);R(a,!0);O.enter(a,c,b);return D(function(h){return G("enter","ng-enter",f.element(g(a)),c,b,t,d,h)})},leave:function(a,c){c=I(c);a=f.element(a);q(a);R(a,!0);return D(function(b){return G("leave","ng-leave",f.element(g(a)),null,null,function(){O.leave(a)},c,b)})},move:function(a,c,b,d){d=I(d);a=f.element(a);
c=c&&f.element(c);b=b&&f.element(b);q(a);R(a,!0);O.move(a,c,b);return D(function(h){return G("move","ng-move",f.element(g(a)),c,b,t,d,h)})},addClass:function(a,c,b){return this.setClass(a,c,[],b)},removeClass:function(a,c,b){return this.setClass(a,[],c,b)},setClass:function(a,c,b,d){d=I(d);a=f.element(a);a=f.element(g(a));if(R(a))return O.$$setClassImmediately(a,c,b,d);var h,k=a.data("$$animateClasses"),l=!!k;k||(k={classes:{}});h=k.classes;c=aa(c)?c:c.split(" ");n(c,function(a){a&&a.length&&(h[a]=
!0)});b=aa(b)?b:b.split(" ");n(b,function(a){a&&a.length&&(h[a]=!1)});if(l)return d&&k.options&&(k.options=f.extend(k.options||{},d)),k.promise;a.data("$$animateClasses",k={classes:h,options:d});return k.promise=D(function(e){var l=a.parent(),b=g(a),c=b.parentNode;if(!c||c.$$NG_REMOVED||b.$$NG_REMOVED)e();else{b=a.data("$$animateClasses");a.removeData("$$animateClasses");var c=a.data("$$ngAnimateState")||{},d=S(a,b,c.active);return d?G("setClass",d,a,l,null,function(){d[0]&&O.$$addClassImmediately(a,
d[0]);d[1]&&O.$$removeClassImmediately(a,d[1])},b.options,e):e()}})},cancel:function(a){a.$$cancelFn()},enabled:function(a,c){switch(arguments.length){case 2:if(a)B(c);else{var b=c.data("$$ngAnimateState")||{};b.disabled=!0;c.data("$$ngAnimateState",b)}break;case 1:r.disabled=!a;break;default:a=!r.disabled}return!!a}}}]);C.register("",["$window","$sniffer","$timeout","$$animateReflow",function(r,C,M,Y){function y(){b||(b=Y(function(){c=[];b=null;x={}}))}function H(a,e){b&&b();c.push(e);b=Y(function(){n(c,
function(a){a()});c=[];b=null;x={}})}function P(a,e){var b=g(a);a=f.element(b);k.push(a);b=Date.now()+e;b<=h||(M.cancel(d),h=b,d=M(function(){X(k);k=[]},e,!1))}function X(a){n(a,function(a){(a=a.data("$$ngAnimateCSS3Data"))&&n(a.closeAnimationFns,function(a){a()})})}function Z(a,e){var b=e?x[e]:null;if(!b){var c=0,d=0,f=0,g=0;n(a,function(a){if(1==a.nodeType){a=r.getComputedStyle(a)||{};c=Math.max(Q(a[z+"Duration"]),c);d=Math.max(Q(a[z+"Delay"]),d);g=Math.max(Q(a[K+"Delay"]),g);var e=Q(a[K+"Duration"]);
0<e&&(e*=parseInt(a[K+"IterationCount"],10)||1);f=Math.max(e,f)}});b={total:0,transitionDelay:d,transitionDuration:c,animationDelay:g,animationDuration:f};e&&(x[e]=b)}return b}function Q(a){var e=0;a=ea(a)?a.split(/\s*,\s*/):[];n(a,function(a){e=Math.max(parseFloat(a)||0,e)});return e}function R(b,e,c,d){b=0<=["ng-enter","ng-leave","ng-move"].indexOf(c);var f,p=e.parent(),h=p.data("$$ngAnimateKey");h||(p.data("$$ngAnimateKey",++a),h=a);f=h+"-"+g(e).getAttribute("class");var p=f+" "+c,h=x[p]?++x[p].total:
0,m={};if(0<h){var n=c+"-stagger",m=f+" "+n;(f=!x[m])&&u.addClass(e,n);m=Z(e,m);f&&u.removeClass(e,n)}u.addClass(e,c);var n=e.data("$$ngAnimateCSS3Data")||{},k=Z(e,p);f=k.transitionDuration;k=k.animationDuration;if(b&&0===f&&0===k)return u.removeClass(e,c),!1;c=d||b&&0<f;b=0<k&&0<m.animationDelay&&0===m.animationDuration;e.data("$$ngAnimateCSS3Data",{stagger:m,cacheKey:p,running:n.running||0,itemIndex:h,blockTransition:c,closeAnimationFns:n.closeAnimationFns||[]});p=g(e);c&&(I(p,!0),d&&e.css(d));
b&&(p.style[K+"PlayState"]="paused");return!0}function D(a,e,b,c,d){function f(){e.off(D,h);u.removeClass(e,k);u.removeClass(e,t);z&&M.cancel(z);G(e,b);var a=g(e),c;for(c in s)a.style.removeProperty(s[c])}function h(a){a.stopPropagation();var b=a.originalEvent||a;a=b.$manualTimeStamp||b.timeStamp||Date.now();b=parseFloat(b.elapsedTime.toFixed(3));Math.max(a-H,0)>=C&&b>=x&&c()}var m=g(e);a=e.data("$$ngAnimateCSS3Data");if(-1!=m.getAttribute("class").indexOf(b)&&a){var k="",t="";n(b.split(" "),function(a,
b){var e=(0<b?" ":"")+a;k+=e+"-active";t+=e+"-pending"});var s=[],q=a.itemIndex,v=a.stagger,r=0;if(0<q){r=0;0<v.transitionDelay&&0===v.transitionDuration&&(r=v.transitionDelay*q);var y=0;0<v.animationDelay&&0===v.animationDuration&&(y=v.animationDelay*q,s.push(B+"animation-play-state"));r=Math.round(100*Math.max(r,y))/100}r||(u.addClass(e,k),a.blockTransition&&I(m,!1));var F=Z(e,a.cacheKey+" "+k),x=Math.max(F.transitionDuration,F.animationDuration);if(0===x)u.removeClass(e,k),G(e,b),c();else{!r&&
d&&(F.transitionDuration||(e.css("transition",F.animationDuration+"s linear all"),s.push("transition")),e.css(d));var q=Math.max(F.transitionDelay,F.animationDelay),C=1E3*q;0<s.length&&(v=m.getAttribute("style")||"",";"!==v.charAt(v.length-1)&&(v+=";"),m.setAttribute("style",v+" "));var H=Date.now(),D=V+" "+$,q=1E3*(r+1.5*(q+x)),z;0<r&&(u.addClass(e,t),z=M(function(){z=null;0<F.transitionDuration&&I(m,!1);0<F.animationDuration&&(m.style[K+"PlayState"]="");u.addClass(e,k);u.removeClass(e,t);d&&(0===
F.transitionDuration&&e.css("transition",F.animationDuration+"s linear all"),e.css(d),s.push("transition"))},1E3*r,!1));e.on(D,h);a.closeAnimationFns.push(function(){f();c()});a.running++;P(e,q);return f}}else c()}function I(a,b){a.style[z+"Property"]=b?"none":""}function S(a,b,c,d){if(R(a,b,c,d))return function(a){a&&G(b,c)}}function T(a,b,c,d,f){if(b.data("$$ngAnimateCSS3Data"))return D(a,b,c,d,f);G(b,c);d()}function U(a,b,c,d,f){var g=S(a,b,c,f.from);if(g){var h=g;H(b,function(){h=T(a,b,c,d,f.to)});
return function(a){(h||t)(a)}}y();d()}function G(a,b){u.removeClass(a,b);var c=a.data("$$ngAnimateCSS3Data");c&&(c.running&&c.running--,c.running&&0!==c.running||a.removeData("$$ngAnimateCSS3Data"))}function q(a,b){var c="";a=aa(a)?a:a.split(/\s+/);n(a,function(a,d){a&&0<a.length&&(c+=(0<d?" ":"")+a+b)});return c}var B="",z,$,K,V;N.ontransitionend===W&&N.onwebkittransitionend!==W?(B="-webkit-",z="WebkitTransition",$="webkitTransitionEnd transitionend"):(z="transition",$="transitionend");N.onanimationend===
W&&N.onwebkitanimationend!==W?(B="-webkit-",K="WebkitAnimation",V="webkitAnimationEnd animationend"):(K="animation",V="animationend");var x={},a=0,c=[],b,d=null,h=0,k=[];return{animate:function(a,b,c,d,f,g){g=g||{};g.from=c;g.to=d;return U("animate",a,b,f,g)},enter:function(a,b,c){c=c||{};return U("enter",a,"ng-enter",b,c)},leave:function(a,b,c){c=c||{};return U("leave",a,"ng-leave",b,c)},move:function(a,b,c){c=c||{};return U("move",a,"ng-move",b,c)},beforeSetClass:function(a,b,c,d,f){f=f||{};b=q(c,
"-remove")+" "+q(b,"-add");if(f=S("setClass",a,b,f.from))return H(a,d),f;y();d()},beforeAddClass:function(a,b,c,d){d=d||{};if(b=S("addClass",a,q(b,"-add"),d.from))return H(a,c),b;y();c()},beforeRemoveClass:function(a,b,c,d){d=d||{};if(b=S("removeClass",a,q(b,"-remove"),d.from))return H(a,c),b;y();c()},setClass:function(a,b,c,d,f){f=f||{};c=q(c,"-remove");b=q(b,"-add");return T("setClass",a,c+" "+b,d,f.to)},addClass:function(a,b,c,d){d=d||{};return T("addClass",a,q(b,"-add"),c,d.to)},removeClass:function(a,
b,c,d){d=d||{};return T("removeClass",a,q(b,"-remove"),c,d.to)}}}])}])})(window,window.angular);
//# sourceMappingURL=angular-animate.min.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
{
"name": "angular-animate",
"version": "1.3.6",
"main": "./angular-animate.js",
"ignore": [],
"dependencies": {
"angular": "1.3.6"
}
}

View File

@@ -0,0 +1,26 @@
{
"name": "angular-animate",
"version": "1.3.6",
"description": "AngularJS module for animations",
"main": "angular-animate.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.js.git"
},
"keywords": [
"angular",
"framework",
"browser",
"animation",
"client-side"
],
"author": "Angular Core Team <angular-core+npm@google.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular.js/issues"
},
"homepage": "http://angularjs.org"
}

Some files were not shown because too many files have changed in this diff Show More