cerebral-legacy / cerebral-module-router

An opinionated URL change handler for Cerebral
http://cerebral-website.herokuapp.com/documentation/cerebral-module-router
19 stars 4 forks source link

expose method to get url from signalName + parameters #22

Closed Guria closed 9 years ago

Guria commented 9 years ago

We should be able to make traditional links based on routing config since it allows to use rightClick + copy or rightClick + open in new tab actions.

It could be achieved with method to get url from signalName and parameters. So it would be able to create something like Link component @jeroenverfallie mentioned in #14 and without extra router configuration

<Link signal="someSignal" args={ { someParam: true } } >

which will render to

<a href="/#/url/param" onClick=(e) = { e.preventDefault(); this.props.signals.someSignal( { someParam: true })}>
christianalfoni commented 9 years ago

Yeah, this is a good idea :-) It is specific to react though. Would suggest we put this on the cerebral-react package.

Guria commented 9 years ago

<Link /> is cerebral-react part of course. But, an url should be extracted from router/signal somehow.

Guria commented 9 years ago

symmetrical directive for angular would also useful

christianalfoni commented 9 years ago

Yeah, hm, have to figure out a good way to do this :-) Probably the signal will just get a new property that is the url it is bound to. But yeah, will solve this. Very nice suggestion indeed!

christianalfoni commented 9 years ago

Added to next release issue: https://github.com/christianalfoni/cerebral-router/issues/44

Guria commented 9 years ago

41 address this