diff --git a/ng-cordova/appAvailability-tests.ts b/ng-cordova/appAvailability-tests.ts
new file mode 100644
index 0000000000..c9e2be537b
--- /dev/null
+++ b/ng-cordova/appAvailability-tests.ts
@@ -0,0 +1,41 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.appavailability {
+ 'use strict';
+
+ export class AppAvailabilityController {
+
+ isAvailable:boolean;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaDevice", "$cordovaAppAvailability"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService,
+ private $cordovaDevice:ngCordova.IDeviceService,
+ private $cordovaAppAvailability:ngCordova.IAppAvailabilityService) {
+
+ this.isAvailable = false;
+
+ var scheme = "com.twitter.android";
+
+ if ($cordovaDevice.getPlatform() == 'iOS') {
+ scheme = "twitter://";
+ }
+
+ $ionicPlatform.ready(() => {
+ $cordovaAppAvailability.check(scheme).then(() => {
+ this.isAvailable = true;
+ }, (err) => {
+ // bad api design in plugin as well as in ngCordova !!
+ this.isAvailable = false;
+ })
+ });
+ }
+
+ }
+
+ angular.module("demo.appavailability").controller("AppAvailabilityController", AppAvailabilityController);
+}
diff --git a/ng-cordova/appAvailability.d.ts b/ng-cordova/appAvailability.d.ts
new file mode 100644
index 0000000000..ec873ba8da
--- /dev/null
+++ b/ng-cordova/appAvailability.d.ts
@@ -0,0 +1,14 @@
+// Type definitions for ngCordova AppAvailability plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IAppAvailabilityService {
+ check(urlScheme: string): ng.IPromise;
+ }
+
+}
diff --git a/ng-cordova/deviceMotion-tests.ts b/ng-cordova/deviceMotion-tests.ts
new file mode 100644
index 0000000000..b838661978
--- /dev/null
+++ b/ng-cordova/deviceMotion-tests.ts
@@ -0,0 +1,58 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.devicemotion {
+ 'use strict';
+
+ export class DeviceMotionController {
+
+ motion:ngCordova.IDeviceMotionAcceleration;
+ this_watch:ngCordova.IDeviceMotionWatchPromise;
+ msg:string;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaDeviceMotion"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaDeviceMotion:ngCordova.IDeviceMotionService) {
+ $ionicPlatform.ready(() => {
+ this.getAcceleration();
+ });
+ }
+
+ getAcceleration () {
+ this.$cordovaDeviceMotion.getCurrentAcceleration().then( (motion) => {
+ this.motion = motion;
+ console.log(motion);
+ }, function (err) {
+ this.msg = err.message;
+ console.log(err);
+ });
+ }
+
+ watchAcceleration () {
+ var options = { frequency: 3000 }; // Update every 3 seconds
+
+ this.this_watch = this.$cordovaDeviceMotion.watchAcceleration(options);
+
+ this.this_watch.then(
+ () => { /* unused */
+ },
+ (err) => {
+ this.msg = err.message;
+ },
+ (motion) => {
+ this.motion = motion;
+ });
+ };
+
+ clearWatch () {
+ // use watchID from watchAccelaration()
+ this.$cordovaDeviceMotion.clearWatch(this.this_watch.watchID);
+ };
+
+ }
+
+ angular.module("demo.devicemotion").controller("DeviceMotionController", DeviceMotionController);
+}
diff --git a/ng-cordova/deviceMotion.d.ts b/ng-cordova/deviceMotion.d.ts
new file mode 100644
index 0000000000..b9f524bbfe
--- /dev/null
+++ b/ng-cordova/deviceMotion.d.ts
@@ -0,0 +1,34 @@
+// Type definitions for ngCordova device motion plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Michel Vidailhet
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IDeviceMotionAcceleration {
+ x: number;
+ y: number;
+ z: number;
+ timestamp: number;
+ }
+
+ export interface IDeviceMotionAccelerometerOptions {
+ frequency: number;
+ }
+
+ export interface IDeviceMotionWatchPromise extends ng.IPromise {
+ watchID: number;
+ cancel: () => void;
+ clearWatch: (watchId?: number) => void;
+ }
+
+ export interface IDeviceMotionService {
+ getCurrentAcceleration(): ng.IPromise;
+ watchAcceleration(options: IDeviceMotionAccelerometerOptions): IDeviceMotionWatchPromise;
+ clearWatch(watchId: number): void;
+ }
+
+}
diff --git a/ng-cordova/deviceOrientation-tests.ts b/ng-cordova/deviceOrientation-tests.ts
new file mode 100644
index 0000000000..b192fe583e
--- /dev/null
+++ b/ng-cordova/deviceOrientation-tests.ts
@@ -0,0 +1,65 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.deviceorientation {
+ 'use strict';
+
+ export class DeviceOrientationController {
+
+ msg:string;
+ heading:ngCordova.IDeviceOrientationHeading;
+ this_watch:ngCordova.IDeviceOrientationWatchPromise;
+
+ static $inject:Array = ["$ionicPlatform", "$timeout", "$cordovaDeviceOrientation"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService,
+ private $timeout:ng.ITimeoutService,
+ private $cordovaDeviceOrientation:ngCordova.IDeviceOrientationService) {
+
+ $ionicPlatform.ready(() => {
+ this.getHeading();
+ });
+
+ }
+
+ getHeading() {
+ this.$cordovaDeviceOrientation
+ .getCurrentHeading()
+ .then((position) => {
+ this.heading = position;
+ }, (err) => {
+ this.msg = err.message;
+ });
+ };
+
+
+ watchHeading () {
+ this.this_watch = this.$cordovaDeviceOrientation.watchHeading({frequency: 1000});
+
+ this.this_watch.then(
+ () => {
+ /* unused */
+ },
+ (err) => {
+ this.msg = err.message;
+ },
+ (position) => {
+ this.$timeout(() => {
+ this.heading = position;
+ });
+ }
+ );
+
+ };
+
+ clearWatch () {
+ this.$cordovaDeviceOrientation.clearWatch(this.this_watch.watchID);
+ };
+
+ }
+
+ angular.module("demo.deviceorientation").controller("DeviceOrientationController", DeviceOrientationController);
+}
diff --git a/ng-cordova/deviceOrientation.d.ts b/ng-cordova/deviceOrientation.d.ts
new file mode 100644
index 0000000000..a955a9f0ad
--- /dev/null
+++ b/ng-cordova/deviceOrientation.d.ts
@@ -0,0 +1,35 @@
+// Type definitions for ngCordova device orientation plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Michel Vidailhet
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IDeviceOrientationHeading {
+ magneticHeading: number;
+ trueHeading?: number;
+ headingAccuracy?: number;
+ timestamp?: number;
+ }
+
+ export interface IDeviceOrientationWatchOptions {
+ frequency?: number;
+ filter?: number;
+ }
+
+ export interface IDeviceOrientationWatchPromise extends ng.IPromise {
+ watchID: number;
+ cancel: () => void;
+ clearWatch: (watchId?: number) => void;
+ }
+
+ export interface IDeviceOrientationService {
+ getCurrentHeading(): ng.IPromise;
+ watchHeading(options: IDeviceOrientationWatchOptions): IDeviceOrientationWatchPromise;
+ clearWatch(watchID: number): void;
+ }
+
+}
diff --git a/ng-cordova/dialogs-tests.ts b/ng-cordova/dialogs-tests.ts
new file mode 100644
index 0000000000..2e6c152b9c
--- /dev/null
+++ b/ng-cordova/dialogs-tests.ts
@@ -0,0 +1,47 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.dialog {
+ 'use strict';
+
+ export class DialogController {
+
+ action:string;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaDialogs"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaDialogs:ngCordova.IDialogsService) {
+ this.action = "Press any button !";
+ }
+
+ alert() {
+ this.action = "Alert";
+ this.$cordovaDialogs.alert('Wow!');
+ }
+
+ confirm() {
+ this.action = "Confirm";
+ this.$cordovaDialogs.confirm('Are you sure?', "Custom title").then(function (buttonIndex) {
+ this.$cordovaDialogs.alert("Button index : " + buttonIndex);
+ });
+ }
+
+ prompt() {
+ this.action = "Prompt";
+ this.$cordovaDialogs.prompt('Please Login', "Custom title").then(function (result) {
+ this.$cordovaDialogs.alert("Input: " + result.input1 + "\n Button index : " + result.buttonIndex);
+ });
+ }
+
+ beep() {
+ this.action = "Beep";
+ this.$cordovaDialogs.beep(3);
+ }
+
+ }
+
+ angular.module("demo.dialog").controller("DialogController", DialogController);
+}
diff --git a/ng-cordova/dialogs.d.ts b/ng-cordova/dialogs.d.ts
new file mode 100644
index 0000000000..99d8cba55a
--- /dev/null
+++ b/ng-cordova/dialogs.d.ts
@@ -0,0 +1,23 @@
+// Type definitions for ngCordova dialogs plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Michel Vidailhet
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IDialogsPromptResult {
+ input1: string;
+ buttonIndex: number;
+ }
+
+ export interface IDialogsService {
+ alert(message: string, title?: string, buttonName?: string): ng.IPromise;
+ confirm(message: string, title?: string, buttonArray?: Array): ng.IPromise;
+ prompt(message: string, title?: string, buttonArray?: Array, defaultText?: string): ng.IPromise;
+ beep(repetitions: number): void;
+ }
+
+}
diff --git a/ng-cordova/emailComposer-tests.ts b/ng-cordova/emailComposer-tests.ts
new file mode 100644
index 0000000000..8880939a51
--- /dev/null
+++ b/ng-cordova/emailComposer-tests.ts
@@ -0,0 +1,47 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.email {
+ 'use strict';
+
+ export class EmailComposerController {
+
+ isAvailable:boolean;
+ status:string;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaEmailComposer"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService, $cordovaEmailComposer:ngCordova.IEmailComposerService) {
+
+ this.status = "";
+
+ $ionicPlatform.ready(() => {
+
+ $cordovaEmailComposer.isAvailable().then((available) => {
+ this.isAvailable = available;
+ });
+
+ let email = {
+ to: 'max@mustermann.de',
+ cc: 'erika@mustermann.de',
+ bcc: ['john@doe.com', 'jane@doe.com'],
+ subject: 'Cordova Icons',
+ body: 'How are you? Nice greetings from Leipzig',
+ isHtml: true
+ };
+
+ $cordovaEmailComposer.open(email).then(null, () => {
+ // user cancelled email
+ this.status = "User Cancelled Email";
+ });
+
+ });
+ }
+
+ }
+
+ angular.module("demo.email").controller("EmailComposerController", EmailComposerController);
+}
diff --git a/ng-cordova/emailComposer.d.ts b/ng-cordova/emailComposer.d.ts
new file mode 100644
index 0000000000..22aa7afdd9
--- /dev/null
+++ b/ng-cordova/emailComposer.d.ts
@@ -0,0 +1,28 @@
+// Type definitions for ngCordova emailComposer plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IEmailComposerOptions {
+ to: string | Array;
+ cc?: string | Array;
+ bcc?: string | Array;
+ attachments?: Array;
+ subject?: string;
+ body?: string;
+ isHtml?: boolean;
+ }
+
+ export interface IEmailComposerService {
+
+ isAvailable(): ng.IPromise;
+ open(properties: IEmailComposerOptions);
+ addAlias(app: string, schema: string);
+
+ }
+
+}
diff --git a/ng-cordova/geolocation-tests.ts b/ng-cordova/geolocation-tests.ts
new file mode 100644
index 0000000000..59e7807da8
--- /dev/null
+++ b/ng-cordova/geolocation-tests.ts
@@ -0,0 +1,39 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.geolocation {
+ 'use strict';
+
+ export class GeolocationController {
+
+ erroMsg:string;
+ position:ngCordova.IGeoPosition;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaGeolocation"];
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaGeolocation:ngCordova.IGeolocationService) {
+
+ }
+
+ getLocation = function () {
+
+ this.$cordovaGeolocation
+ .getCurrentPosition({timeout: 10000, enableHighAccuracy: false})
+ .then((position) => {
+ console.log("position found");
+ this.position = position;
+ // long = position.coords.longitude
+ // lat = position.coords.latitude
+ }, (err) => {
+ console.log("unable to find location");
+ this.errorMsg = "Error : " + err.message;
+ });
+ };
+
+ }
+
+ angular.module("demo.geolocation").controller("GeolocationController", GeolocationController);
+}
diff --git a/ng-cordova/geolocation.d.ts b/ng-cordova/geolocation.d.ts
new file mode 100644
index 0000000000..15a0c55eed
--- /dev/null
+++ b/ng-cordova/geolocation.d.ts
@@ -0,0 +1,42 @@
+// Type definitions for ngCordova geolocation plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface IGeoPositionError {
+ code:number;
+ message:string;
+ }
+
+ export interface IGeoCoordinates {
+ latitude?:number;
+ longitude?:number;
+ accuracy?:number;
+ altitude?:number;
+ heading?:number;
+ speed?:number;
+ altitudeAccuracy?:number;
+ }
+
+ export interface IGeoPosition {
+ coords:IGeoCoordinates;
+ timestamp:Date;
+ }
+
+ export interface IGeolocationOptions {
+ timeout?: number;
+ maximumAge?: number;
+ enableHighAccuracy?: boolean;
+ }
+
+ export interface IGeolocationService {
+ getCurrentPosition(options?: IGeolocationOptions) : ng.IPromise;
+ watchPosition(options?: IGeolocationOptions) : ng.IPromise;
+ clearWatch(watchID: {[key: string]: any}) : void;
+ }
+
+}
diff --git a/ng-cordova/network-tests.ts b/ng-cordova/network-tests.ts
new file mode 100644
index 0000000000..35b270cbe5
--- /dev/null
+++ b/ng-cordova/network-tests.ts
@@ -0,0 +1,43 @@
+///
+///
+///
+
+// For the full application demo please see following repo :
+// https://github.com/ksachdeva/ngCordova-typescript-demo
+
+namespace demo.network {
+ 'use strict';
+
+ export class NetworkController {
+
+ networkType:string;
+ connectionType:string;
+ errorMsg:string;
+
+ static $inject:Array = ["$ionicPlatform", "$cordovaNetwork"];
+
+ constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaNetwork:ngCordova.INetworkInformationService) {
+
+ $ionicPlatform.ready(() => {
+ this.refresh();
+ });
+ }
+
+ refresh() {
+ this.networkType = this.$cordovaNetwork.getNetwork();
+ if (this.$cordovaNetwork.isOnline()) {
+ this.connectionType = 'Online';
+ }
+ else if (this.$cordovaNetwork.isOffline()) {
+ this.connectionType = 'Offline';
+ }
+ else {
+ this.errorMsg = 'Error getting isOffline / isOnline methods';
+ }
+ }
+
+ }
+
+
+ angular.module("demo.network").controller("NetworkController", NetworkController);
+}
diff --git a/ng-cordova/network.d.ts b/ng-cordova/network.d.ts
new file mode 100644
index 0000000000..218871418a
--- /dev/null
+++ b/ng-cordova/network.d.ts
@@ -0,0 +1,19 @@
+// Type definitions for ngCordova network plugin
+// Project: https://github.com/driftyco/ng-cordova
+// Definitions by: Kapil Sachdeva
+// Definitions: https://github.com/ksachdeva/DefinitelyTyped
+
+///
+
+declare module ngCordova {
+
+ export interface INetworkInformationService {
+
+ getNetwork(): string;
+ isOnline(): boolean;
+ isOffline(): boolean;
+ clearOfflineWatch(): void;
+ clearOnlineWatch(): void;
+ }
+
+}
diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts
index 726ea99e6e..188cb367d1 100644
--- a/ng-cordova/tsd.d.ts
+++ b/ng-cordova/tsd.d.ts
@@ -5,3 +5,10 @@
///
///
+///
+///
+///
+///
+///
+///
+///