Skip to content

[Question] onClick with this.transitionToRoute #6

@ChangJoo-Park

Description

@ChangJoo-Park

Hello
I need to change route when click list item.
this is my handlebars.

  {{#ui-list
       items= model.transactions
       size='default'
       mood='mood'
       skin='default'
       compressed=true
       sortAscending=true
       onClick='onClick'
       as |list| }}
      {{#each model.transactions as |item| }}
          {{ui-item
               link=item.id
               title=item.place
               subHeading=item.when
               list=list }}
      {{/each}} {{/ui-list}}

and my route.

import Ember from 'ember';

export default Ember.Controller.extend({
  actions: {
    onClick(item) {
      Ember.Logger.info("CLICK");
      Ember.Logger.info(item.item.get('link'));
      this.transitionToRoute('lists.show.transactions', item.item.get('link'));
    },
  }
});

I think it is bad code. how can I change a route when click item?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions