Skip to content

Instantly share code, notes, and snippets.

@leandrojo
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save leandrojo/9986653 to your computer and use it in GitHub Desktop.

Select an option

Save leandrojo/9986653 to your computer and use it in GitHub Desktop.
this.getCurrentPosition = function() {
var position = $q.defer();
geolocation.getCurrentPosition(function(pos) {
position.resolve(pos);
}, function() {
position.reject();
});
return position.promise;
};
this.render = function() {
this.getCurrentPosition.then(function(position) {
// modifica aqui o dom
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment