I am trying to poll additional data using the documented function model.reload ()
App.ModelViewRoute = Ember.Route.extend({ actions: { reload: function() { this.get('model').reload(); } } });
But I get an error message saying ...
undefined is not a function TypeError: undefined is not a function
Is there a better way to do this, it seems like I cannot access the model this way from the route?
Here is the router
App.Router.map(function() { this.route('video', { path: '/videos/:video_id' }); });
Here is the route
App.VideoRoute = Ember.Route.extend({ model: function(params) { return this.store.find('video', params.video_id); }, actions: { reloadModel: function() {
Here is a model
App.Video = DS.Model.extend({ title: DS.attr('string'), status: DS.attr('string') });
And patterns
<script type="text/x-handlebars" data-template-name="application"> <h1>Testing model reloading</h1> {{#link-to "video" 1}}view problem{{/link-to}} {{outlet}} </script> <script type="text/x-handlebars" data-template-name="video"> <h1>Video</h1> <h2>{{title}}</h2> {{model.status}} <p><button {{action 'reloadModel'}}>Reload model</button></p> </script>
I made jsbin problems here:
http://jsbin.com/wofaj/13/edit?html,js,output
I really can't understand why rebooting gives me this error. Any advice would be highly appreciated.
thanks
Chris source share