0

I want to add region-based search functionality to my Ionic 1.* app. When a customer search for a store, they would get store (results) that are close to them, maybe a mile or two. Am using a PHP as my api

How to I achieve this?

Ayo 'Lana
  • 137
  • 2
  • 5

1 Answers1

0

You want to use angular's $http to make an http request to your api.

$http.get('urlToYourAPIEndpoint')
    .then((response) => {
        // append response to dom
    });

Some tips:

Kolby
  • 2,775
  • 3
  • 25
  • 44
  • I know that. My question is, how do implement a region based search. i.e. search for stores close to my region with ionic. – Ayo 'Lana Oct 21 '16 at 18:01
  • @Ayo'Lana That's something you should do on the backend, ideally with mysql, but you could do it with php. Then return the results via http request. Look into the Haversine formula. This shoudl help: http://stackoverflow.com/questions/14750275/haversine-formula-with-php – Kolby Oct 21 '16 at 18:56