Chaplin.helpers → Source

Helpers that use Chaplin components (global event bus etc.).

reverse(routeName[,...params])

Returns the URL for a named route, appropriately filling in values given as params.

For example, if you have declared the route

match '/users/:login/profile', 'users#show'
match('/users/:login/profile', 'users#show');

you can use

Chaplin.helpers.reverse 'users#show', login: 'paulmillr'
# or
Chaplin.helpers.reverse 'users#show', ['paulmillr']
Chaplin.helpers.reverse('users#show', {login: 'paulmillr'});
// or
Chaplin.helpers.reverse('users#show', ['paulmillr']);

to yield '/users/paulmillr/profile'.