ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Get Location (Latitude and Longitude) using Google Maps API in AngularJS<p>Hi&nbsp;skp,</p> <p>Using the below articles i have created the example.&nbsp;</p> <p>Check this example. Now please take its reference and correct your code.</p> <h1 class="header"><a title="Get Current Location Latitude and Longitude using JavaScript and HTML5'a" href="https://www.aspsnippets.com/Articles/Get-Current-Location-Latitude-and-Longitude-using-JavaScript-and-HTML5.aspx">Get Current Location Latitude and Longitude using JavaScript and HTML5</a></h1> <h1 class="header"><a title="Google Maps V3: Get address from Latitude and Longitude'a" href="https://www.aspsnippets.com/Articles/Google-Maps-V3-Get-address-from-Latitude-and-Longitude.aspx">Google Maps V3: Get address from Latitude and Longitude</a></h1> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://maps.googleapis.com/maps/api/js?sensor=false&amp;key=API_KEY&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, []); app.controller(&#39;MyController&#39;, function () { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (p) { var latlng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ &#39;latLng&#39;: latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { alert( &#34;Location: &#34; + results[1].formatted_address + &#34;\nLatitude : &#34; + p.coords.latitude + &#34;\nLongitude : &#34; + p.coords.longitude); } } }); }); } else { alert(&#39;Geo Location feature is not supported in this browser.&#39;); } }); &lt;/script&gt; &lt;/head&gt; &lt;body ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/0FfJ9Do.jpg" alt="" width="472" height="242" /></span></strong></p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Mon, 05 Aug 2019 05:08:55 GMTGet Location (Latitude and Longitude) using Google Maps API in AngularJS<p>Getting an error :</p> <p>&nbsp;Google Maps JavaScript API error: InvalidKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key-map-error</p> <pre class="brush: js">angular.module(&#39;myApp&#39;). controller(&#39;dashboardController&#39;, function ($scope, $http, $sessionStorage, $window, $location, useragent) { var apiUrl = &#34;http://stagingserver:85/EBSApi&#34;; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (p) { var latlng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ &#39;latLng&#39;: latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { $window.alert( &#34;Location: &#34; + results[1].formatted_address + &#34;\nLatitude : &#34; + p.coords.latitude + &#34;\nLongitude : &#34; + p.coords.longitude); } } }); }); } else { alert(&#39;Geo Location feature is not supported in this browser.&#39;); } });</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Mon, 05 Aug 2019 05:20:41 GMTGet Location (Latitude and Longitude) using Google Maps API in AngularJS<p>You need to replace the google api key in place of API_KEY.</p> <p><font>In order to execute the&nbsp;</font><a class="info-link" href="https://www.aspsnippets.com/Search.aspx?q=Google%20Maps" target="_blank">Google Maps</a><font>&nbsp;application you will need to register and get an API key from Google API. For more details refer&nbsp;</font><a class="info-link" href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">here</a><font><font>.</font></font></p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Mon, 05 Aug 2019 05:32:09 GMTGet Location (Latitude and Longitude) using Google Maps API in AngularJS<p>Do we have any solution without using google maps api.</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Mon, 12 Aug 2019 00:50:06 GMTGet Location (Latitude and Longitude) using Google Maps API in AngularJS<p>Refer below link.</p> <p><a href="https://www.npmjs.com/package/angularjs-geolocation">https://www.npmjs.com/package/angularjs-geolocation</a></p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Tue, 13 Aug 2019 06:29:17 GMTGet Location (Latitude and Longitude) using Google Maps API in AngularJS<p>I guess the geolocation doesn't support in http site, but it supports localhost site.</p> <p><a href="https://jsfiddle.net/deepumohanp/a4g2J/">https://jsfiddle.net/deepumohanp/a4g2J/</a></p> <p>Only when it comes to https site, it supports.</p>https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/https://www.aspforums.net:443/Threads/156963/Get-Location-Latitude-and-Longitude-using-Google-Maps-API-in-AngularJS/Fri, 16 Aug 2019 01:05:27 GMT