Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4831

What is the right approach of catch block inside the model() hook in emberjs

$
0
0

@mikeelemuel wrote:

Am I allowed to add a catch method in my model hook? i.e. something like this:

model(params) { return this.store.findRecord(‘shop’, params.slug).catch(() => this.transitionTo(‘welcome.shops.index’)) },

My goal is to route the user whenever he entered the incorrect slug. If there is a better approach to my desire behaviour please suggest it. Would appreciate any help, thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4831

Trending Articles