Loading event when saving form

I was reading up on Loading / Error Substates - Routing - Ember Guides And I am wonder if when I submit a form that does not transition, can I call this loading event or do I need to build my own solution?

@jrock2004 What does you form do? I don’t think you can manually move to the loading state if you aren’t triggering any of these hooks: beforeModel / model / afterModel.

For these kind of scenarios I would recommend using Ember concurrency. You can handle loading states really easy:

Example:

<button onclick={{perform submitTask}} class={{if submitTask.isRunning 'disabled'}} >
  {{#if submitTask.isRunning}}
    Saving...
  {{else}}
    Save
  {{/if}}
</button>
1 Like