isCurrent
Check if data represents the current route.
route.isCurrent(data [,subsetMatch] )
Compares data to the current route. Used to verify if an object is
representative of the current route.
route.data.set({page: "recipes", id: '5'});
route.isCurrent({page: "recipes"}); //-> false
route.isCurrent({page: "recipes"}, true); //-> true
Parameters
- data
{Object}:Data to check agains the current route.
- subsetMatch
{Boolean}:If true,
route.currentwill return true if every value indatamatches the current route data, even if the route data has additional properties that are not matched. Defaults tofalsewhere every property needs to be present.
Returns
{Boolean}:
Whether the data matches the current URL.
Use
Checks the page's current URL to see if the route represents the options passed into the function.
Returns true if the options represent the current URL.
route.data.id = 5; // location.hash -> "#!id=5"
route.isCurrent({ id: 5 }); // -> true
route.isCurrent({ id: 5, type: 'videos' }); // -> false
route.data.type = 'videos';
// location.hash -> #!id=5&type=videos
route.isCurrent({ id: 5, type: 'videos' }); // -> true