i am making this sample app to start using geolocalization services, right now i followed the documentation and there is no errors whatsoever, it just silently seem not to enter into the then of the promise, for example console.log(‘POSITIONS’) isnt shown.
I
this is my controllers:
angular.module('starter.controllers', [])
.controller('VendedorCtrl', function($scope, $cordovaGeolocation) {
$scope.crearNota = function() {
$cordovaGeolocation.getCurrentPosition().then(function (position) {
var lat = position.coords.latitude
var lgt = position.coords.longitude
console.log('POSITIONS');
console.log(lat);
console.log(lgt);
}, function(err) {
// error
alert(err);
});
};
});
my index.html
<!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></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="starter">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content>
<form name="nota" ng-controller="VendedorCtrl" ng-submit="crearNota(vendedor)">
<div class="list">
<label class="item item-input">
<input type="text" placeholder="Tarea" ng-model="vendedor.tarea">
</label>
<label class="item item-input">
<textarea placeholder="Notas" ng-model="vendedor.nota"></textarea>
</label>
</div>
<div class="padding">
<button type="submit" class="button button-block button-positive icon-left ion-person">Notificar</button>
</div>
</form>
</ion-content>
</ion-pane>
</body>
</html>