Common search for whole site


#1

I have been trying to understand ember, and got little understanding. I had posted a question here before but didnt got reply; and now I am posting a new question here.

I have created a common search form in the application.hbs which have two dropdowns, I want to have url like http://localhost:4200/search/:cityid/:groupid/ but it dont load the data, when I transition into the url, If I refresh the browser it loads the data from rest.

I checked by converting these to query string parameters and that are working fine but I need to have a cleaner url.

I have posted the question on http://stackoverflow.com/questions/29754151/emberjs-load-the-model-data-with-search with all the details


#2

I am now getting following error,

Error: Assertion Failed: The value that #each loops over must be an Array. You passed {citySef: Lahore, group: An}

So its a simple search form, where I have group model, and city model, and in search result I am loading users with certain group within a city.

When I press the submit button I get the assertion failed error, and URL is changed. Now if I reload the URL it loads the proper data

I also tried to change it to array

from

this.transitionToRoute('search', {citySef:citySef, group:group});

to

var arr = []; 
arr['citySef'] = citySef; 
arr['group'] = group;
this.transitionToRoute('search', arr);

but this time I see url change but there no call to server to load the data and there is no error.

Now as the URL is changed, i clicked back in browser it loads the previous page, clicking on next from browser did load the users. So I press the search it change URL without any result, i click back and forward and it loads the result.


#3

solved it by https://github.com/emberjs/ember.js/issues/2904

now trying to set the controller dropdown values as per url

Able to load the values in dropdown, by following

controller/search.js

export default Ember.Controller.extend({
  needs: 'application',
  selectedGroup: Ember.computed.alias('controllers.application.selectedGroup'),
  selectedCity: Ember.computed.alias('controllers.application.selectedCity'),
}

So selectedGroup and selectedCity both are two variables in the application, and are bind with dropdowns. and in routes/search.js I have used setupController with

controller.set('selectedGroup', models.query.group);
controller.set('selectedCity', models.query.citySef);

Any one can help me with the pagination with laravel? I am trying serializer but I think it is not getting called. console.log() is not executing in serializer. Question is posted here http://stackoverflow.com/questions/30055301/emberjs-with-laraval-pagination as well