Skip to content

Support for router/controller actions #39

@seanrucker

Description

@seanrucker

In the example it suggests the fetch function should be a property of the route and that a direct reference to that function be passed to the component. This won't run the function in the scope of the route and therefore you can not access the store.

{{#impagination-dataset fetch=fetch}}
export default Ember.Route.extend({
    fetch: function(pageOffset, pageSize, stats) {
        return this.store.query(...); // fail
    })
});

I was expecting that I would pass the name of the action that should be run as a string as is consistent with other components.

{{#impagination-dataset fetch="fetch"}}
export default Ember.Route.extend({
    actions: {
        fetch(pageOffset, pageSize, stats) {
            return this.store.query(...); // success
        })
    }
});

As a temporary workaround I am doing this:

{{#impagination-dataset fetch=(action "fetch")}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions