I'm working on creating a view that displays JSON data from an API endpoint such as www.example.com/api/compare_segments?338,340
I need to display that data in my app at www.myapp.com/compare/338,340, but I'm only getting a blank page and an error message:
"Assertion failed: Error while loading route: Error: Computed Property declared without a property function"
When I comment out the model hook in the route file, it loads the correct template (which is currently only displaying arbitrary filler text.) When the model hook is not commented out, it only displays the blank screen and the error message.
Any ideas why the template won't load and how to resolve the error message?
app/router.js:
var Router = Ember.Router.extend(); // ensure we don't share routes between all Router instances
Router.map(function() {
this.resource('compare', { path: "compare/:ids"} );
});
export default Router;
app/routes/compare.js:
var CompareRoute = Ember.Route.extend({
model: function(params) {
return $.ajax({
url:('/api/compare_segments'+params.ids),
method: 'get',
dataType: 'json',
data: JSON.stringify,
accepts: 'json'
}).then(null, function() {
return { msg: "Recovered from rejected promise"};
});
},
});
export default CompareRoute;
app/views/compare.js:
export default Ember.View.extend({
templateName: 'compare',
});