diff --git a/ignite-html-router.js b/ignite-html-router.js
index b1666df..dd41d6d 100644
--- a/ignite-html-router.js
+++ b/ignite-html-router.js
@@ -7,7 +7,7 @@ import { IgniteCallback} from "../ignite-html/ignite-html.js";
* @class IgniteTemplate
* @memberof IgniteTemplate
* @param {String,String[]} routes A single or multiple set of routes that will invoke the callback if met.
- * @param {Function(data)} showCallback A callback function that is called when the route is shown. Default is null.
+ * @param {Function(route, data)} showCallback A callback function that is called when the route is shown. Default is null.
* @param {Function} hideCallback A callback function that is called when the route is hidden. Default is null.
* @param {Boolean} strict If true all routes must match before running the callback. Default is false.
* @returns {IgniteTemplate} This ignite template.
@@ -21,6 +21,7 @@ IgniteTemplate.prototype.route = function(routes, showCallback = null, hideCallb
//Create an update method that will be used to check and see if the route is met.
var update = (event) => {
var routeMatches = false;
+ var matchedRoute = null;
//Create an object to hold any data.
var data = {};
@@ -29,11 +30,13 @@ IgniteTemplate.prototype.route = function(routes, showCallback = null, hideCallb
if (!strict) {
for (var i = 0; i < routes.length && !routeMatches; i++) {
routeMatches = Router.matches(routes[i], data);
+ matchedRoute = routes[i];
}
} else {
routeMatches = true;
for (var i = 0; i < routes.length && routeMatches; i++) {
routeMatches = Router.matches(routes[i], data);
+ matchedRoute = routes[i];
}
}
@@ -43,7 +46,7 @@ IgniteTemplate.prototype.route = function(routes, showCallback = null, hideCallb
this.element.style.removeProperty("display");
if (showCallback) {
- showCallback((event && event.data ? event.data : data));
+ showCallback(matchedRoute, (event && event.data ? event.data : data));
}
} else {
//Hide the route element.