mardi 10 mars 2020

EmberJS transitionTo() not taking me to the destination

router.js:

  this.route('404', { path: '/*path' });

application/route.js:

import Route from '@ember/routing/route';
import DS from 'ember-data';

const { NotFoundError } = DS;

export default Route.extend(
    actions: {
      error(error) {
        if (error instanceof NotFoundError) {
          //this.transitionTo('404') not working
          this.intermediateTransitionTo('404', {});

          return;
        }
        throw error;
      }
    }
  }
);

If I do this.transitionTo('index'), it works, but not with 404. Why is this.intermediateTransitionTo('404', {}); working? Is it because of the path argument in this.route('404', { path: '/*path' });?




Aucun commentaire:

Enregistrer un commentaire