javascript - angular js maps call: url failed to load webpage the url can't be shown -
i'm trying make maps call ionic framework app. in html file use:
<a ng-href="maps://?q={{dest.latitude}},{{dest.longitude}}">maps</a> <div>{{dest.latitude}},{{dest.longitude}}</div>
in controller data dest
looks this:
{"latitude":12.34567, "longitude":1.23456}
the latitude , longitude shown in div correctly.
but error if click on link:
failed load webpage error: url can't shown
i tried cast lat , long string had no effect on it.
if use static geocordinates works fine:
<a ng-href="maps://?q=12.34567,1.23456">maps</a>
what missing?
you have add map
in href sanitization white list.
example code:
angular.module('app',[]) .config( function( $compileprovider ){ $compileprovider.ahrefsanitizationwhitelist(/^\s*(https?|ftp|mailto|chrome-extension|map|geo|skype):/); } );
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="app"> <a ng-href="map:lat=51.527141,lon=-0.087853">map</a> <a ng-href="skype:username">skype</a> </div>
Comments
Post a Comment