Search code examples
jqueryember.jsember-dataember-routerember-rails

How to create a route with a dynamic value in ember


I am new to ember. If u find my question silly please dont mind.

I have a route '/lobby' which shows a different options.

when user chooses one particular option i want to create route /lobby/option_choosen(this will be the value which user chosen).

How to create route in ember in this scenario.


Solution

  • Please read ember guide dynamic segment part for defining routes. and for model preparing you can read dynamic model .

    In router.js,

    Router.map(function() {
      this.route('lobbies');
      this.route('lobby', { path: '/lobby/:lobby_id' });
    });