lundi 30 avril 2018

Redirecting in EmberJS

I'm relatively new to EmberJS, so any help is appreciated. I'm trying to do something I feel should be theoretically simple - I have a component and on one of the DOM elements, I want to have a click handler which redirects to a route, but I've been unable to figure out how to make that happen.

I have my component: //components/sample-card-header.js

import Component from '@ember/component';
export default Component.extend({
  actions: {
    goToSamples() {
      this.transitionTo('samples');
    }
  }
});

And my handlebars template:

//templates/components/sample-card-header.hbs

<div class="card_header" >Samples</div>

I know I can just do: <div class="card_header" onClick="window.location.href=('/samples')" > but I'd like to use the router paths.

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire