I'm trying to wrangle my way through my first Ember.js app, and am struggling to figure out how to take my boilerplate/tutorial-based code and get it to pass parameters through to my Flask backend.
I want to serve up local events based on zip code, with the zip code being passed through to the backend.
I came across this page on Opting into a Full Transition (http://ift.tt/1B0Pklj) and am now seeing the parameter name but not the value coming through the request to the API.
I visit this URL in my browser: http://localhost:5000/?zip=21210
and I get:
127.0.0.1 - - [22/Dec/2014 23:20:51] "GET /?zip=21210 HTTP/1.1" 200 - # first call to load page
127.0.0.1 - - [22/Dec/2014 23:20:52] "GET /api/v1/events?zip= HTTP/1.1" 200 - # call to API
my app.js file:
App = Ember.Application.create();
App.Router.map(function() {
location: 'auto'
// put your routes here
//this.resource('events', {path: '/'})
});
//var attr = DS.attr;
DS.RESTAdapter.reopen({
namespace: 'api/v1'
});
App.Event = DS.Model.extend({
name: DS.attr('string'),
address: DS.attr('string')
});
App.IndexRoute = Ember.Route.extend({
queryParams: {
zip: {
refreshModel: true
}
},
model: function(params) {
return this.store.findQuery('event', params);
}
});
App.IndexController = Ember.ArrayController.extend({
queryParams: ['zip'],
zip: null
});
Aucun commentaire:
Enregistrer un commentaire