Skip to content

Commit de7f971

Browse files
committed
add route to request object
1 parent bea0959 commit de7f971

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,6 @@ function($middlewareProvider)] {
212212
* **params** (optional): A params object to be used to populate query parameters _(ngRoute)_ or `$stateParams` _(ui.router)_
213213
* **options** (optional): An object of [transitionTo](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#statetransitiontoto-toparams--options) options (only used with ui.router)
214214

215+
* `this.route` is the destination route path
216+
215217
* `this.params` is an object that contains the current route parameters

dist/angular-middleware.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ function middlewareFactory($injector, $q) {
4949
// Store a copy of the route parameters in the request
5050
request.params = angular.copy(toParams);
5151

52+
// Store route name in the request
53+
request.route = toRoute.name;
54+
5255
// Set the middleware index to 0
5356
middleware.index = 0;
5457

dist/angular-middleware.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/middleware.factory.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ function middlewareFactory($injector, $q) {
4646
// Store a copy of the route parameters in the request
4747
request.params = angular.copy(toParams);
4848

49+
// Store route name in the request
50+
request.route = toRoute.name;
51+
4952
// Set the middleware index to 0
5053
middleware.index = 0;
5154

0 commit comments

Comments
 (0)