/*jslint white:true*/
/*global angular*/
/*global alert*/

var myapp;
if (myapp === undefined) {
    myapp = angular.module('myapp', ['ionic']);
}
   
myapp.controller('bindControl', function ($http, $timeout) {
    'use strict';
//    var bindCtrl = this;
//
//    document.addEventListener("deviceready", function () {
//        $cordovaGeolocation.getCurrentPosition({
//            timeout : Number(window.localStorage.timeOut),
//            enableHighAccuracy : true
//        }).then(function (position) {
//            var lat  = position.coords.latitude,
//                long = position.coords.longitude;
//            alert('lat =',lat,'long =',long);
//        }, function (err) {
//            alert(err);
//        });
//    }, false);
    
    document.addEventListener("deviceready", function () {
        navigator.contacts.find(['id', 'displayName'], function (contacts) {
            alert('Found ' + contacts.length + ' contacts.');
        }, function (err) {
            alert(err);
        });
    }, false);
});
@@ -234,18 +234,16 @@
 rict';%0D%0A
-//
     var 
@@ -261,87 +261,61 @@
 this
-;%0D%0A//%0D%0A//    document.addEventListener(%22deviceready%22, function (
+,%0D%0A        onSuccess = function(position
 ) %7B%0D%0A
-//
         
 $cor
@@ -314,114 +314,246 @@
     
-$cordovaGeolocation.getCurrentPosition(%7B%0D%0A//            timeout : Number(window.localStorage.timeOut),%0D%0A//
+alert('Latitude: '          + position.coords.latitude          + '%5Cn' +%0D%0A              'Longitude: '         + position.coords.longitude         + '%5Cn' +%0D%0A              'Altitude: '          + position.coords.altitude          + '%5Cn' +%0D%0A
     
@@ -564,26 +564,19 @@
     
-enableHigh
+  '
 Accuracy
  : t
@@ -575,82 +575,104 @@
 racy
- 
 : 
-true%0D%0A//        %7D).then(function (position) %7B%0D%0A//            var lat  =
+'          + position.coords.accuracy          + '%5Cn' +%0D%0A              'Altitude Accuracy: ' +
  pos
@@ -688,133 +688,360 @@
 rds.
-l
 a
+l
 titude
-,%0D%0A//                long = position.coords.longitude;%0D%0A//            alert('lat =',lat,'long =',long);%0D%0A//        %7D,
+Accuracy  + '%5Cn' +%0D%0A              'Heading: '           + position.coords.heading           + '%5Cn' +%0D%0A              'Speed: '             + position.coords.speed             + '%5Cn' +%0D%0A              'Timestamp: '         + position.timestamp                + '%5Cn');%0D%0A    %7D;%0D%0A%0D%0A    // onError Callback receives a PositionError object%0D%0A    //%0D%0A   
  fun
@@ -1050,23 +1050,26 @@
 ion 
+onError
 (err
+or
 ) %7B%0D%0A
-//    
     
@@ -1082,46 +1082,105 @@
 ert(
-err);%0D%0A//        %7D);%0D%0A//    %7D, false);
+'code: '    + error.code    + '%5Cn' +%0D%0A              'message: ' + error.message + '%5Cn');%0D%0A    %7D%0D%0A
 %0D%0A  
@@ -1239,24 +1239,97 @@
 ction () %7B%0D%0A
+        navigator.geolocation.getCurrentPosition(onSuccess, onError);%0D%0A//
         navi
@@ -1390,24 +1390,26 @@
 ontacts) %7B%0D%0A
+//
             
@@ -1455,24 +1455,26 @@
 ntacts.');%0D%0A
+//
         %7D, f
@@ -1486,24 +1486,26 @@
 on (err) %7B%0D%0A
+//
             
@@ -1513,24 +1513,26 @@
 lert(err);%0D%0A
+//
         %7D);%0D

Test geolocation plugin