Suggestions on main page/REST API

Hey guys,
I try to create a simple song database app. A full-text search function shall be implemented. So if I type in the title or some words of the lyrics, I want to display a list of songs, which fit to the search request.

Here are my questions:

I. Which is the right way to search for a song:

  1. send a GET request for ALL songs and filter with Angular
  2. send a GET request for a specific song and let the REST API filter through the results
  3. something else?

II. I want a list of suggestions on my main page, depending on my previous search requests. How to program that? Do you know any tutorials or can you give me a hint?

The less data you transfer, the best.
I would do the search on server because you can benefit from advanced search tools like elastic search.


from what i have done before,
i think it depends of how many songs did you have.
i have created an app which will GET ALL data (about 100+ data as JSON) when the APP start,
then store the data using Angular Factory. the data will remain avaible as a object stored in a variable, even after the request complete.

maybe this would help,

the controller to get and store data to factory

.controller('getAndStoreDataCtrl', function ($storeData,$http,$scope) {
 $http.get('url/to/get/data.json').success(function(response) {
   for (var i=0; i < response.length; i++) {
       $storeData[i] = response[i];

Factory to store data

.factory('$storeData', function() {
     var data = {};
     return data; 

last, the controller and scope which will access the data

.controller('accessDataCtrl', function ($storeData,$scope) {
      $scope.storeData = $storeData;

for a list and suggestion on text search, i have created an search + suggestion toggle dialog on Header using ng-filter and ng-model to filter and show data on main page,
check this out, hope this help

1 Like

Thank you so much, that’s really helpful!