© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
suraj rathod
student and javascript lover more into web design and web development
hey , I am practicing vuejs and i am facing one problem I want to initially call the api using the longitude and latitude in the created() lifecycle.
watch the pen and please help me
codepen.io/surajrathod/pen/ZyOveV
Levan Gabeskiria
Web Development
You can use geolocation api:
created(){ //want to make api call using latitude and longitude// if (navigator.geolocation) { navigator.geolocation.getCurrentPosition((position) => { this.apiCall( position.coords.latitude, position.coords.longitude ); }); } }
Thanx for the help, how do u like ui
it's good
Suraj E.S.
language and framework agnostic developer
Use Vue Resource and call the method
Levan Gabeskiria
Web Development
You can use geolocation api:
created(){ //want to make api call using latitude and longitude// if (navigator.geolocation) { navigator.geolocation.getCurrentPosition((position) => { this.apiCall( position.coords.latitude, position.coords.longitude ); }); } }