aurelia-contrib / aurelia-getting-started

Basically a queue of topics and examples to cover
MIT License
20 stars 5 forks source link

add a paragraph on how to use router outside of a component defining router #12

Open Alexander-Taran opened 6 years ago

Alexander-Taran commented 6 years ago

issue in router repo for reference: https://github.com/aurelia/router/issues/412

For a beginer it was not obvious how to get router inside a vm other than configureRouter and using that one w/o routes ended up badly

Got to add it in meaningful way.

Most common use case is to navigate in code I'd go with that..

if you want to use router.navigate... inside a component that does not define routes... ... some text giving an example of import {}

@autoinject / js example of DI

and using a method..

reference to DI section of docs

mention other possible use cases of an injected router class..