4

I am trying to use the geo: uri in Cordova. It works when I do something like:

<a href="geo:0,0q=12345+jefferson+st">link1</a>

but if I do something like with angular:

<a ng-href="{{location}}">{{location}}>link2</a>

and

location = "geo:0,0q=12345+jefferson+st";

it will not work. Any ideas?

1 Answers1

4

You need to explicitly add geo: to Angular's whitelist using a regular expression using $compileProvider. Otherwise Angular will prefix a non-whitelisted href URLs with unsafe: when using a unrecognized url by $compileProvider.

Config

var app = angular.module( 'app', [] )
.config( ['$compileProvider', function( $compileProvider ){   
        $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|geo):/);
}]);

Hopefully this could help you, Thanks.

Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299