From e1da7a7f00255b8f248b23af4e98362c714cc500 Mon Sep 17 00:00:00 2001 From: cibernox Date: Tue, 19 Jul 2016 11:57:51 +0100 Subject: [PATCH] More typos, add syntax highlighting and improve wording --- text/router-enhancements.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/text/router-enhancements.md b/text/router-enhancements.md index 8d30d8276f..0cbcf0f377 100644 --- a/text/router-enhancements.md +++ b/text/router-enhancements.md @@ -81,7 +81,7 @@ any other would cause the route to miss. Mimicking rails micro syntax, I propose optional segments to be enclosed between parenthesis. The example of the Apple store would be encoded -``` +```js Router.map(function() { this.route('product', { path: '(/:region)/:productName' }); }); @@ -158,8 +158,8 @@ router.serialize('/forecast/newton'); // => not recognized route. router.serialize('/forecast'); // => routeName='forecast', params: { } ``` -In all cases the same `forecast` route is invoked, but the scale is not optional but the constraint -takes care that, if provided, the scale is a supported one. +On this example `forecast` route is invoked even if the scale is ommited, but if it's not ommited, +the constraint ensures that it's among a white-list of supported scales. # How We Teach This @@ -188,7 +188,7 @@ at once? Per example: ```js Router.map(function() { - this.route('forecast', { + this.route('activities', { path: 'activities/from/:from/to/:to', constraints: function(from, to) { // This constraint takes both dynamic segments and performs an assertion @@ -199,8 +199,8 @@ Router.map(function() { }); -router.serialize('/activitis/from/2016-04-11/to/2016-05-20'); // => matches -router.serialize('/activitis/from/2016-06-11/to/2016-05-20'); // => fails to match +router.serialize('/activities/from/2016-04-11/to/2016-05-20'); // => matches to `activities` +router.serialize('/activities/from/2016-06-11/to/2016-05-20'); // => fails to match ``` - How complex can constraints be? Just pure functions or can they have access to services? I think