I'd like to detect if the browser made a request via AJAX (AngularJS) so that I can return a JSON array, or if I have to render the template. How can I do this?
There isn't any way to be certain whether a request is made by ajax.
What I found that worked for me, was to simply include a get parameter for xhr requests and simply omit the parameter on non-xhr requests.
For example:

XHR Request: example.com/search?q=Boots&api=1
Other Requests: example.com/search?q=Boots
How can I identify requests made via AJAX in Python's Flask?